[Scons-users] Creating SConscripts on the fly

Bill Deegan bill at baddogconsulting.com
Thu Feb 22 10:19:58 EST 2018


On Thu, Feb 22, 2018 at 10:12 AM, <syost at triad.rr.com> wrote:

> Thanks - we are converting to SCons, and the powers that be indicated that
> the developers would only maintain the old style build configuration
> files.  So I have to parse them and build on the fly based on their
> contents.  To prevent confusing this conversation with the "whys", lets
> just say for the moment creating SConscript files on the fly is necessary
> (explanation below if you care).
>
> So I guess my question is, restated more clearly:   Can I use SCons to
> build SConscript files and process them in one pass?  Based on my limited
> experience and the replies it seems like there is not; but I figured maybe
> someone has this figured out.
>

I'd say.. Sort of.. See my previous answer in this thread. Do the
conversion in SConstruct, but not using SCons' dependency tree.  I'm
guessing the build files don't have any dependencies? If so, that it should
be fairly simple.  The tree's utility goes up when you have complicated
sets of dependencies.




>
> Explanation:  I could go ahead and simply execute the statements that I
> currently store in an SConscript; inline during the SConsctruct
> processing.  But that creates a couple of dilemmas for us, mainly no "audit
> trail".  The SConscript serves as a great, succinct audit of what a build
> would do for a particular module and aids in unit tests for, and code
> review of, my work.  That was especially handy early on while testing the
> parsing.  Also - I am hoping when they see how simple the SConscript files
> really are, we will finally get rid of the old config files and start
> maintaining the SConscript files.  In the end, the building inline with
> SConstruct is a nut I am not interested in cracking right now.
>
> ---- Gary Granger <granger at ucar.edu> wrote:
> > Hi Spencer,
> >
> > If you already have the information to generate the SConscript file from
> > within a scons builder, then why not just call the builders directly and
> > let scons build the software normally, without requiring an intermediate
> > SConscript file?  What purpose does generating the SConscript file serve?
> >
> > In normal operation, SCons first reads all the SConscript files to build
> > up the graph of nodes and dependencies, and then it builds whatever
> > nodes are outdated or missing.  So I don't think you can specify that a
> > SConscript file is a node that needs to be built, then read that
> > SConscript file to modify the graph of nodes and build again, not
> > without running SCons twice.
> >
> > So in your code which determines whether a module needs to be built,
> > rather than generating a SConscript file, just call the builders that
> > the SConscript file would have called.  If a module does not need to be
> > built, then it is ok to skip calling those builders.  Once all the
> > builders for all the modules have been called, SCons will build all the
> > modules in one run.
> >
> > I hope I understood your situation and this makes sense...
> > Gary
> >
> > On 02/21/2018 10:35 PM, Spencer Yost wrote:
> > > I know this has been covered before, and I apologize for plowing old
> ground. I did search around but came up empty handed.  I have a question:
> > >
> > > I create my SConscript files on the fly. I have my own system for
> determining whether or not it needs to be built for a particular module in
> the tree, then I build it if needed and then make the SConscript() call.
> this works great.  So I decided I want to create a builder for this
> SConscript creation  - just because that seemed to be the "right" way to do
> it.  But if I use a custom builder it will not build the software if it
> determines the SConscript file needs to be built.  It just creates the
> SConscript file. If it doesn't have to create/recreate, it will build the
> software.
> > >
> > > I have become experienced enough with Scons now to realize why it is
> doing this. But there has to be a way to get it to build the SConscript
> file using a builder and build the software without running a second time.
> Does anyone have a slick way of combining the creation of the SConscript
> while also building?  I do not have a "root"(at the SConstruct level)
> SConscript file - which may the be the answer - but thought  I would ask
> smarter people than me before I spent the time.
> > >
> > > Thanks in advance!
> > >
> > > Spencer Yost
> > >
> > > _______________________________________________
> > > Scons-users mailing list
> > > Scons-users at scons.org
> > > https://pairlist4.pair.net/mailman/listinfo/scons-users
> >
>
> _______________________________________________
> 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/20180222/d85d0205/attachment-0001.html>


More information about the Scons-users mailing list