[Scons-users] Wacky crash in Clone()
Marc Branchaud
marcnarc at xiplink.com
Tue Jan 25 09:42:24 EST 2022
On 2022-01-24 17:06, Bill Deegan wrote:
> So you just want CCFLAGS to be overwritten in the action? (or is this
> just an example?)
Not CCFLAGS, but variables that affect the behaviour of the BaseBuilder.
These should not retain their values after the invocation of the
Builder, so stuffing them into a cloned Environment was convenient. (My
example showed the Clone() call in message(), but it was also happening
in the builder() function.)
This code is over 10 years old, and I think it would be implemented very
differently today -- not just to avoid Cloning inside an Action. But a
major refactoring is beyond the scope at this time.
> If you can be specific about what you want to override with your
> Clone(), I'd be there's another way to accomplish that than the Clone()..
>
> It may just be more advanced SCons-Fu.. :)
I rewrote things to avoid cloning Environments, and now all is joy --
thanks for the pointer!
For future spelunkers, my solution is a bit hacky: I taught the
BaseBuilder to drive its behaviour from a combination of the Environment
and a module-level "overrides" dict. The MyBuilder sets what it needs
in BaseBuilder.overrides, and BaseBuilder.builder() clears the overrides
when it's done.
Thanks again!
M.
More information about the Scons-users
mailing list