[Scons-users] Wacky crash in Clone()

Bill Deegan bill at baddogconsulting.com
Tue Jan 25 14:57:56 EST 2022


Can you be more specific about what info an action would want to change
with the builder?
More details = possible expert help on how to implement it in a "safe" way..

On Tue, Jan 25, 2022 at 6:42 AM Marc Branchaud <marcnarc at xiplink.com> wrote:

> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20220125/a41dadb0/attachment.htm>


More information about the Scons-users mailing list