[Scons-users] Wacky crash in Clone()

Mats Wichmann mats at wichmann.us
Wed Feb 2 13:02:20 EST 2022


On 2/2/22 08:05, Marc Branchaud via Scons-users wrote:
> On 2022-01-25 14:57, Bill Deegan wrote:
>> 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..
> 
> Recall that I have a "BaseBuilder" and a "MyBuilder" that extends/adapts
> it (I'm omitting the generate() and exists() functions):

This looks like a use case for pseudo builders, via the AddMethod call.
There are sone examples in the user guide

https://scons.org/doc/production/HTML/scons-user.html#chap-add-method

> 
>     site_scons/BaseBuilder.py
>         def builder(target, source, env):
>             # Do some bookkeeping, then run the build command:
>             subprocess.call( ... )
> 
>     site_scons/site_tools/MyBuilder.py
>         import BaseBuilder
>         def builder(target, source, env):
>             # Set up stuff for the BaseBuilder, then run it.
>             return BaseBuilder.builder(target, source, env)
> 
> MyBuilder wants to do things like add extra options and/or set shell
> environment variables for the command run by the BaseBuilder.
> 
> There is also a "PlainBuilder" that just invokes the BaseBuilder
> directly (I did not show this in my original message):
> 
>     site_scons/site_tools/PlainBuilder.py
>         import BaseBuilder
> 
>         def generate(env, **kwargs):
>             env['BUILDERS']['PlainBuilder'] = env.Builder(
>                 action = env.Action(
>                     BaseBuilder.builder,
>                     BaseBuilder.message,
>                 )
>             )
> 
> Invocations of PlainBuilder will themselves set their own options and/or
> shell variables for the command.
> 
> Whatever MyBuilder sets up for BaseBuilder should not pollute
> PlainBuilder invocations of BaseBuilder.
> 
> In SCons 2.x I did this by cloning the build environment inside
> MyBuilder and tweaking the clone as needed.
> 
> In SCons 4.x I changed this to use a module-level "overrides" dict
> inside BaseBuilder.py.
> 
> (Sorry for the slow replay.  After I managed to fix my problem, $work
> priorities took over.)
> 
>         M.
> 
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users



More information about the Scons-users mailing list