[Scons-users] scons and module files

William Blevins wblevins001 at gmail.com
Mon Mar 14 17:55:47 EDT 2016


Inline

On Mon, Mar 14, 2016 at 9:02 PM, John Robinson <jsrobin at gmail.com> wrote:

> What is the appropriate manner to use SCons in the context of a "module"
> environment (http://modules.sourceforge.net/).
>
> I know that one strategy is to just initialize the SConstruct environment
> with the command:
> env = Environment(ENV = os.environ)
> after loading the appropriate module files.
>
> Naturally, this kills the "Environment independent" build feature of
> SCons. In particular, the "builder" may have almost any type of "overrides"
> occurring in his Linux startup environment after the modules have been
> loaded.
>
> Is it possible for a SConstruct file to start off by "sourcing" "module
> load" and "module unload" commands and then continuing execution with a
> repeatable "os.environ".
>

SCons runs inside the python interpreter, so I'm not sure that would be
possible given how os.environ works.
https://docs.python.org/2/library/os.html


>
> Alternatively, is there an easy for for SConstruct to create a subshell
> initialized with the selected module commands, and then invoke an
> appropriate "SConstruct" to continue the build.
>

SCons can execute Actions including scripts and shell commands, so this is
possible although possibly scary.


>
>
> Any and all comments and help would be appreciated on this issue.
>


What you might consider is creating scripts that "load X; <call compiler
with arguments>" and replace your CC construction variable with your script.



>
> _______________________________________________
> 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/20160314/fcae92d0/attachment.html>


More information about the Scons-users mailing list