[Scons-users] [EXT] Re: Can SCons be called from a wrapper script?

Don Baldwin donb at qti.qualcomm.com
Fri Mar 15 18:59:20 EDT 2019

Thanks Bill.  Passing the SConstruct commands via the command line will help me avoid having to write the code.


From: Scons-users <scons-users-bounces at scons.org> On Behalf Of Bill Deegan
Sent: Friday, March 15, 2019 10:21 AM
To: SCons users mailing list <scons-users at scons.org>
Subject: [EXT] Re: [Scons-users] Can SCons be called from a wrapper script?


You can have SCons read the sconstruct from stdin.
So you could subprocess.popen and pass your script that way, then just have it wait til the process is complete.

Currently importing and calling SCons  via python directly is not a supported use model.
It has come up maybe once a year as a request, but no one has stepped forward to do the work.
If you'd like to come up with a PR and/or fund such development that's the most likely way this would come to fruition.

Also you might consider inverting the use model and having SCons drive your process..


On Fri, Mar 15, 2019 at 9:47 AM Don Baldwin <donb at qti.qualcomm.com<mailto:donb at qti.qualcomm.com>> wrote:

I have a use case where I’d like to be able to use SCons to process some actions as part of a larger Python script.  I’d like to be able to import scons, pass it an SConstruct file as a string, and then have it return to me once the build is done.  I see examples where you can import SCons.Script and call SCons.Script.main(), but:

  1.  SCons.Script.main() doesn’t take any parameters, so it seems like I might have to write my script to a file first before calling this function.
  2.  SCons.Script.main() calls sys.exit() at the end, which would end my wrapper script as well.

Is there another way to do what I’m trying to do, and if not, would it be possible to add this support in future versions?

Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190315/4b2f0c00/attachment.html>

More information about the Scons-users mailing list