[Scons-users] How to prepend all commands to enable switching execution environments..
William Deegan
bill at baddogconsulting.com
Thu Oct 31 13:59:31 EDT 2013
Robert,
On Oct 31, 2013, at 9:51 AM, robert zeigler <robert.zeigler at gmail.com> wrote:
> I have a situation where a build command can be wrapped in several different ways, depending on the build environment. The wrapping doesn't change the actual command executed, it only changes the scheduling of the execution (think: slurm, open grid engine, etc.).
>
> As a very simple example:
>
> Command["target1", "source1", "somecommand < $SOURCE > $TARGET")
>
> Could be executed directly:
>
> somecommand < source1 > target1
>
> or it could be wrapped, say in a call to slurm:
>
> salloc <resources> srun <resources> somecommand < source1 > target1
>
> I would love for this wrapping of build commands to occur "behind the scenes":
> 1) The wrapping should be applied to all executed commands (so external builders and tools should "just work"
> 2) Target freshness should not depend on the type of wrapping that occurs, but /should/ still depend on the command that is wrapped.
>
> I've looked through the documentation at custom builders, "AddMethod", deciders, etc. I can get close to what I want. I might even be able to get there, but I keep thinking there must be a better way than what I'm trying. Is this possible with scons?
Sure. So I'd suggest you just prepend the SHLINK, SHCC SHCXX, etc variables with your prefixing commands. (see http://scons.org/doc/production/HTML/scons-man.html for list of variables)
But wrap them in $( and $) See manpage: env.subst() for details. http://scons.org/doc/production/HTML/scons-man.html
Or you could change env['SHELL'] see manpage as well.
-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131031/846c5220/attachment.htm
More information about the Scons-users
mailing list