Re: Wacky crash in Clone()
Marc Branchaud via Scons-users <[email protected]>
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Organization | XipLink |
| Message-ID | <[email protected]> |
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): 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.