[Scons-users] Creating SConscripts on the fly
Bill Deegan
bill at baddogconsulting.com
Thu Feb 22 10:16:16 EST 2018
Spencer,
I'm sure it could be done, but, it would like to be more complicated than
doing some simpler like:
Basically create your own sconsign file for these build file -> SConscript
generation
Load file
Compare timestamp and MD5 of build file, if hasn't changed since last build
do nothing
If it has, regenerate it's corresponding SConscript.
Do all this in plain python at the top of your SConstruct (possibly logic
in your site_init).
Then process SConscripts thereafter like any other build.
Next level of complication would be do as I suggested in the other email
thread, parse your build script, make the appropriate SCons calls for each
build script.
And don't generate any SConscripts at all.
When I think about these things I try not to think "What is the most
complicated way to do something", but rather, what's the simplest.
Going into the guts of SCons to do what is basically the same as either
above approach would be the most complicated solution by far.
Both in terms of cognitive load to understand all the moving pieces, and in
terms of getting and proving that it's correct (aka tests).
Einstein: “Everything should be as simple as it can be, but not simpler”
That's my two cents.
Hope that helps.
-Bill
On Thu, Feb 22, 2018 at 12:35 AM, Spencer Yost <syost at triad.rr.com> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180222/fcba05b1/attachment.html>
More information about the Scons-users
mailing list