[Scons-users] Getting the result of an action?

Gary Oberbrunner garyo at oberbrunner.com
Thu Sep 25 12:24:06 EDT 2014


On Thu, Sep 25, 2014 at 11:21 AM, Russell E. Owen <rowen at uw.edu> wrote:

> As part of configuring some environment variables in an SConstruct file
> I want to run the command
>
> $CC --version
>
> and parse the output (or raise an exception if it fails). Is there
> something like SCons.Script.Action(action) that I can use? That
> particular command seems to only return the exit code, which isn't what
> I need in this case.
>
> Alternatively, is it safe to use the subprocess module for this?
>

Yes, and yes. :-)  You can use a Configure context to do this, analogous to
how GNU Autoconf would work.  That's the fancy way. But for simple things
it's often simpler just to use subprocess and parse the output.  A
SConstruct is just a python script.

-- 
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20140925/747a9e9c/attachment.html>


More information about the Scons-users mailing list