Daniel Moody
2018-05-25 03:33:58 UTC
I am trying to clone an environment and then make changes to the clone so
that it is different than the original.
But somehow changing the clone also changes my original env? Is that
expected behavior?
Below is an example SConstruct which reproduces the issue (SCons 3.01
installed from pip on windows 10):
env1 = Environment()
env2 = env1.Clone()
print("env2 before = " + env1['SHLINKCOM'].list[0].cmd_list)
env2['SHLINKCOM'].list[0].cmd_list = "echo link command env2"
print("env2 after = " + env1['SHLINKCOM'].list[0].cmd_list)
print("env1 = " + env2['SHLINKCOM'].list[0].cmd_list)
Which produces this output:
C:\Users\Daniel\workspace>scons -f SConstruct.py
scons: Reading SConscript files ...
env2 before = ${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS
$_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES", "$SHLINKCOMSTR")}
env2 after = echo link command env2
env1 = echo link command env2
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
Can someone shed some light on if this is a bug or how do I uniquely modify
the SHLINKCOM?
that it is different than the original.
But somehow changing the clone also changes my original env? Is that
expected behavior?
Below is an example SConstruct which reproduces the issue (SCons 3.01
installed from pip on windows 10):
env1 = Environment()
env2 = env1.Clone()
print("env2 before = " + env1['SHLINKCOM'].list[0].cmd_list)
env2['SHLINKCOM'].list[0].cmd_list = "echo link command env2"
print("env2 after = " + env1['SHLINKCOM'].list[0].cmd_list)
print("env1 = " + env2['SHLINKCOM'].list[0].cmd_list)
Which produces this output:
C:\Users\Daniel\workspace>scons -f SConstruct.py
scons: Reading SConscript files ...
env2 before = ${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS
$_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES", "$SHLINKCOMSTR")}
env2 after = echo link command env2
env1 = echo link command env2
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
Can someone shed some light on if this is a bug or how do I uniquely modify
the SHLINKCOM?