26.3. Accessing SCons Version: the GetSConsVersion Function

While EnsureSConsVersion is acceptable for most cases, there are times where the user will want to support multiple SCons versions simultaneously. In this scenario, it's beneficial to retrieve version information of the currently executing SCons directly. This was previously only possible by accessing SCons internals. From SCons4.8 onwards, it's now possible to instead call GetSConsVersion to recieve a tuple containing the major, minor, and revision values of the current version.

if GetSConsVersion() >= (4, 9):
    # Some function got a new argument in 4.9 that we want to take advantage of
    SomeFunc(arg1, arg2, arg3)
    # Can't use the extended syntax, but it doesn't warrant exiting prematurely
    SomeFunc(arg1, arg2)