[Scons-users] Pulling information out of sconsign

Gary Granger granger at ucar.edu
Tue May 17 15:44:05 EDT 2016


I recently heard about ninja (https://ninja-build.org/), so I considered
how to generate a ninja file from all the information in the SCons node
tree.  Turns out someone had already attempted that: see the
scons_to_ninja.py tool from the Chromium source
(https://src.chromium.org/viewvc/native_client/trunk/src/native_client/pynacl/scons_to_ninja.py?revision=13117&pathrev=13117),
apparently written by mseaborn at chromium.org.  That tool appends to
PRINT_CMD_LINE_FUNC, so that approach may do what you need.

However, I think I wanted to also get the dependency information out, so
I took some ideas from that tool and wrote another one which walks the
node tree to generate the ninja file.  The ninja rules contain the full
expanded command line for the nodes which are built by a shell command. 
I was surprised that it worked as well as it did, but we haven't used it
in practice.  Our source trees always have a few builders which are not
shell commands, so those are harder to account for.  Also, in practice
scons has been fast enough for me, so I'm not sure a hybrid approach is
worth supporting.

The tool is part of our eol_scons project on github:
https://github.com/ncareol/eol_scons/blob/master/eol_scons/tools/ninja.py. 
I think there are only a few dependencies on the eol_scons framework, so
you could probably work around those or at least use it to get an idea
of how the tool traverses the nodes and generates the command strings. 
I don't know if this is a supported and stable part of the scons API
(see the comment about SCons.Node.Walker), but maybe that's not a
concern for you.

HTH,
Gary


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160517/2b6096ca/attachment.html>


More information about the Scons-users mailing list