[Scons-dev] How to traverse the graph after files are read

anatoly techtonik techtonik at gmail.com
Wed May 20 06:43:52 EDT 2015


On Wed, May 20, 2015 at 10:26 AM, Dirk Bächle <tshortik at gmx.de> wrote:
> On 20.05.2015 09:01, anatoly techtonik wrote:
>> On Tue, May 19, 2015 at 3:19 PM, Gary Oberbrunner <garyo at oberbrunner.com>
>> wrote:
>>>
>>> At the end of your SConstruct, start with the target nodes and recurse
>>> into
>>> each node.sources .
>
>
> the "recurse into" is what's important here, Anatoly.

Yes. The problem is to identify the start node. The confusing part is that
node graph is derived from filesystem.

>>> [...]
>>
>>
>> But the logic what happens here and how FS object is transformed
>> into DAG, escapes me.
>
>
> There is no real DAG stored anywhere within the code, like an object that
> you can grab and visit its attributes or traverses its nodes.
> With the call
>
>     else:
>
>         # Build the targets
>         nodes = _build_targets(fs, options, targets, target_top)
>         if not nodes:
>
> SCons starts to dynamically expand the list of children for each given
> target (which includes the so-far detected children of other targets as
> well). So I don't think that you will get at what you actually want...but
> you can try to do a "recursion" light as Gary suggested.

So, if I understood this correctly, the filesystem (fs) tree is the draft of
final graph. E.g. fs object is not just a mirror of filesystem tree - it is a
selective set of files and dirs referenced in SConstruct, right?

I am interested in getting the preliminary graph that is available after
reading SConstruct files. The graph that doesn't add any additional
processing. Is it possible to get it without triggering expansion logic?

Then I may be interested to track graph transformation during the
build phase. But that's secondary.


More information about the Scons-dev mailing list