[Scons-users] Getting build action details

Bill Deegan bill at baddogconsulting.com
Tue Apr 10 17:07:56 EDT 2018


Mats,

It can actually be more than just the Environment()'s and their clones
depending what additional flags you pass to each builder.

env.Program(target,source, CPPPATH=['my','special','paths'])

Will create an OverrideEnvironment() which is a lightweight shell over a
regular Environment which overrides specific variables.

So to get the correct Subst() expansion you'd need the OverrideEnvironment.
If you knew that no variables were set in the OE when the builder was
called, then env.Subst() would be sufficient.


On Tue, Apr 10, 2018 at 4:36 PM, Mats Wichmann <mats at wichmann.us> wrote:

> On 04/10/2018 07:58 AM, Bill Deegan wrote:
> > Also, can you paste an small example.
> >
> > On Tue, Apr 10, 2018 at 9:58 AM, Bill Deegan <bill at baddogconsulting.com>
> > wrote:
> >
> >> Can you explain what you are trying to do?
> >> (Why do you want to do this?)
> >>
> >> That may point out other ways to accomplish what you need than the way
> you
> >> have tried already.
> >>
> >> On Tue, Apr 10, 2018 at 2:05 AM, Nacho Piqueras <natxo.piq at gmail.com>
> >> wrote:
> >>
> >>> Hello,
> >>>
> >>> Given a list a nodes representing object files built by SCons, I would
> >>> like to get the resolved $CPPPATH list for each one.
> >>>
> >>> Inspecting each file object I can see they contain a reference to the
> >>> executor object, and I tried using the overriden environment with the
> >>> executor to subst the variable, but without luck.
> >>>
> >>> Given that some entries in CPPPATH list contain '#', others are
> absolute
> >>> paths and others are relative to the directory of the sconscript that
> told
> >>> SCons to generate that Object, I cannot find a way to easily get that
> >>> information.
> >>>
> >>> Is there something in the Subst module that I can use?
>
> I have at times sought something slightly similar so I'll point out: I
> may be misunderstanding but the settings you care about are not
> per-node, but per-construction-environment.
>
> If there's just one construction environment, Dump() it. Since all the
> scripts are executed first, that is the environment are built up before
> the targets are acted on, put this at the end of your SConstruct and you
> know what each of the targets will be encountering as they build. You
> certainly don't have to dump the whole environment if you are just
> interested in one variable from it, just extract that one instead.
>
> However, if there are many environments you would need to Dump at
> suitable places for each one you care about. I know of no great answer
> in this case.  [[this has driven me nuts in our project - just counted
> again and there are 179 Clone() calls in this beast. sadly I can't wave
> a magic wand and simplify this, I have to improve things piecemeal]]
> This kind of edit-something-in-to-debug becomes painful if you have to
> fiddle with a bunch of sconscripts, and doing it at the top, in the
> SConstruct, is also problematic because it's not going to have the
> context - it has no idea what environments have been created in the
> things it has called (that may then have then called other things etc.)
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180410/1a823e9f/attachment.html>


More information about the Scons-users mailing list