[Scons-users] Controlling display of a builder

Carnë Draug carandraug+dev at gmail.com
Sat Oct 17 14:55:50 EDT 2015


Hi

I have been using the possibility to pass extra arguments to Command
to have them used in a builder.  I am doing something like the following:

    scons_subprocess_call = (lambda target, source, env
                                    : subprocess.call(env['ARGS'], source[0]))

    data = env.Command(
      source = "foo.pl",
      target = "bar.log",
      action = scons_subprocess_call,
      ARGS   = ['homo sapiens', 'Reference GRCh'])

The problem with this is that the output of SCons won't display anything
useful:

    $ scons
    [...]
    scons: Building targets ...
    <lambda>(["bar.log"], ["foo.pl"])
    [...]

The main reason I am doing this is to avoid the shell since some of the
arguments have whitespace, single and double quotes, and even wildcards.
This makes generation of a command problematic.  I have tried to write my
own builder but the problem remains.  I create a Builder either by
setting a `action`, and continue with the problem of not having the actual
call made displayed, or by setting a `generator`, and face the problem of
escaping any weird stuff in the arguments.


Short of having the builder print() something, is there any way to create
a Builder that does not boil down to create a command line for the shell,
while still controlling what SCons displays?

(I am aware that this means that what gets displayed will not match
a command line.  However, it would still be more informative)

Thank you,
Carnë


More information about the Scons-users mailing list