[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
would:
env = Environment()
def generate_foo(target, source, env, for_signature):
return 'FOO_IS_COOL'
env['FOO'] = generate_foo
env['ENV']['FOO'] = '$FOO'
cmd = env.Command(
target='env',
source=[],
action='env > $TARGET'
)
env.Default(cmd)
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.
FOO=*$FOO*
PATH=/usr/local/bin:/opt/bin:/bin:/usr/bin:/usr/sbin:/sbin:/opt/X11/bin
PATHOSX=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
SHLVL=1
_=/usr/bin/env
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.
Thoughts?
Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20191220/47710c4e/attachment.html>
More information about the Scons-users
mailing list