SCons supports an
which can be used to terminate SCons
while reading the
usually because you've detected a condition
under which it doesn't make sense to proceed:
if ARGUMENTS.get('FUTURE'): print("The FUTURE option is not supported yet!") Exit(2) env = Environment() env.Program('hello.c')
scons -Q FUTURE=1The FUTURE option is not supported yet! %
scons -Qcc -o hello.o -c hello.c cc -o hello hello.o
Exit function takes as an argument
the (numeric) exit status that you want SCons to exit with.
If you don't specify a value,
the default is to exit with
which indicates successful execution.
Note that the
is equivalent to calling the Python
(which the it actually calls),
Exit is a SCons function,
you don't have to import the Python
sys module to use it.