[Scons-users] environment variables
Gary Oberbrunner
garyo at oberbrunner.com
Thu Jul 10 11:17:49 EDT 2014
On Thu, Jul 10, 2014 at 10:57 AM, Keith Brown <keith6014 at gmail.com> wrote:
> To further clarify, I would like to run a script called boilerplate.sh
> which will set the appropriate bash environment and then run all my
> subtasks.
>
> The subtasks should inherit the shell environment from boilerplate.sh
>
> That's nontrivial. Shell scripts can't modify environment vars in their
parent. Consider how you'd do this without SCons, e.g. if you're just
making a shell script to do your build. You can't just say
./boilerplate.sh # set vars
subtask_1 ...
subtask_2 ...
because any changes to the shell env done by boilerplate.sh disappear when
that subshell exits.
You can source it:
source ./boilerplate.sh
subtask_1
subtask_2
To do that in SCons, you'd just prepend that source to your Commands:
env.Command(..., 'source boilerplate.sh && subtask1')
but it might be better (cleaner) to modify your boilerplate.sh to spit out
the env var settings it's making on stdout, and read those into your
SConscript (it's just a python script, after all) and use those vars to
update your env['ENV'].
--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140710/b8b0abc8/attachment.html>
More information about the Scons-users
mailing list