[Scons-users] Environment clones linked?

Daniel Moody dmoody256 at gmail.com
Fri May 25 00:23:03 EDT 2018


Thanks that worked!

I didn't understand how deep Clone went. Originally I tried to modify the
Action command directly because I didn't want to mess with the other
actions for the SHLINKCOM.

On Thu, May 24, 2018 at 11:54 PM, Bill Deegan <bill at baddogconsulting.com>
wrote:

> So you're reaching into an Action defined in a builder.
> That's pretty far inside the Environment to a level that there's not a
> deep copy of it.
>
> This when using mslink right?
>
> shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES", "$SHLINKCOMSTR")}', '$SHLINKCOMSTR')
>
> regServerAction = SCons.Action.Action("$REGSVRCOM", "$REGSVRCOMSTR")
>
> embedManifestDllCheckAction = SCons.Action.Action(embedManifestDllCheck, None)
>
> compositeShLinkAction = shlibLinkAction + regServerCheck + embedManifestDllCheckAction
>
> env['SHLINKCOM']   =  compositeShLinkAction
>
>
> In this case I'd expect the Clone copy/deep copying logic would yield what
> you are seeing.
> If you did this:
>
> env2['SHLINKCOM'] = SCons.Action.Action("echo link command env2",None) +
> env2['SHLINKCOM'].list[1] + env2['SHLINKCOM'].list[2]
>
> Then it shouldn't modify env1..
> -Bill
>
>
> On Thu, May 24, 2018 at 8:33 PM, Daniel Moody <dmoody256 at gmail.com> wrote:
>
>> 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?
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180525/51cbc67a/attachment-0001.html>


More information about the Scons-users mailing list