[Scons-users] Custom environment tools evaluated before Configure contexts?

Mats Wichmann mats at wichmann.us
Mon Nov 6 14:54:25 EST 2023


On 11/6/23 12:45, Mats Wichmann wrote:

ehhh, sent too early, as there one more piece to this thought:

> On 11/6/23 09:57, Gary Granger wrote:
>> We have custom tools that call Configure themselves, which I've 
>> assumed is a reasonable thing to do.  (Please let me know if not. :) 
> 
> It works, as long as you keep some things in mind: it's optional what to 
> do with the caching of configure checks. If you run with --config=force, 
> any cached checks are ignored, and as a side effect, the configure 
> context works off a *copy* of the passed env; otherwise it can modify it 
> in place.  This is why we often see stanzas like:
> 
> conf = env.Configure()
> env = conf.Finish()

of course, that stanza doesn't work in a called function like your 
tool's generate(), because you'd only be replacing the local variable 
that holds the passed argument. So there you'd have to pick things out 
if you wanted them, to be safe:

conf_env = conf.Finish
env['FOO'] = conf_env.get("FOO", somedefault)





More information about the Scons-users mailing list