Another way to get information from
a construction environment.
is to use the
on a string containing $-expansions
of construction variable names.
As a simple example,
the example from the previous
section that used
to fetch the value of
could also be written as:
env = Environment() print "CC is:", env.subst('$CC')
The real advantage of using
subst to expand strings is
that construction variables
in the result get
there are no expansions left in the string.
So a simple fetch of a value like
env = Environment(CCFLAGS = '-DFOO') print "CCCOM is:", env['CCCOM']
Will print the unexpanded value of
showing us the construction
variables that still need to be expanded:
% scons -Q CCCOM is: $CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES scons: `.' is up to date.
subst method on
env = Environment(CCFLAGS = '-DFOO') print "CCCOM is:", env.subst('$CCCOM')
Will recursively expand all of the $-prefixed construction variables, showing us the final output:
% scons -Q CCCOM is: gcc -DFOO -c -o scons: `.' is up to date.