[Scons-users] Controlling display of a builder

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Tue Oct 20 04:50:49 EDT 2015


I did try once changing the default SPAWN to not invoke the commands with sh -c ...... It works mostly but occasionally there's code that gets very upset because it's carefully constructed a string and escaped it...

(posix fork code is somewhat of a mess at the moment).


You could change env['SPAWN'] and env['PSPAWN'] to point to your own code for that particular builder.


From: scons-users at scons.org At: Oct 17 2015 19:57:21
To: scons-users at scons.org
Subject: Re:[Scons-users] Controlling display of a builder

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ë
_______________________________________________
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/20151020/3b48abe3/attachment.html>


More information about the Scons-users mailing list