[Scons-users] Builder Arguments: **kwargs?

Gary Oberbrunner garyo at oberbrunner.com
Mon Jul 30 15:12:05 EDT 2012


On Mon, Jul 30, 2012 at 1:55 PM, John Galbraith <jgalb at lanl.gov> wrote:

> I am trying to use scons to keep figures for a paper up to date. Basically,

> my source files are hdf5 data, and my targets are images, csv files, and pdf

> files (from matplotlib). So every time I generate a new hdf5 file, I want

> scons to recreate the figures depending on the data.

>

> So this is working fairly well, actually. But it would be convenient to

> pass arguments to my rules in addition to "source" and "target". I could

> probably stuff arguments in the Environment, but that sounds icky. Right

> now, I am regexing arguments out of the "target" file name, which is also

> nasty and fragile. Is there any way to propogate a kwargs or something like

> that from the rule to the builder? Like:

>

> env.field(target='ez0', source='fulldomain', **kwargs)

>

> where "field" is a custom builder of my own (it writes an image), and "env"

> is the build environment?


Builders (as well as the Actions invoked by builders) have fixed
function signatures. kwargs are already passed as environment
overrides, so there's no easy way right now to pass additional args
through to actions. You can create a pseudo-builder though:
http://www.scons.org/doc/HTML/scons-user/c3829.html which can have any
signature you want.

Also check out Emitters which may or may not help in your situation.

--
Gary


More information about the Scons-users mailing list