[Scons-users] Should substitution apply to values in the Environment's ENV dictionary?
Andrew C. Morrow
andrew.c.morrow at gmail.com
Fri Dec 20 13:36:58 EST 2019
Hi All -
I noticed recently that the following doesn't work as I had expected it
env = Environment()
def generate_foo(target, source, env, for_signature):
env['FOO'] = generate_foo
env['ENV']['FOO'] = '$FOO'
cmd = env.Command(
action='env > $TARGET'
The spawned command gets a literal $FOO for the FOO environment variable,
not the result of substituting $FOO, which should be FOO_IS_COOL.
scons && cat env
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
env > env
scons: done building targets.
I'll admit this may be something of an edge case, but it seems to me to
violate the principle of least surprise given how pervasively substitution
is wired into SCons. I'd think it would be better if this worked. The price
would be additional subst calls the majority of which would not expand, and
subst is known to have real performance overhead.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Scons-users