[Scons-users] Writing a command that always succeeds

Stefan Seefeld stefan at seefeld.name
Tue Jun 14 21:34:10 EDT 2016


On 12.06.2016 21:55, Jason Kenny wrote:
> Ya... in the Main pages you can find this:
>
> Action('$CC -c -o $TARGET $SOURCES')
>
> # Doesn't print the line being executed.
> Action('@build $TARGET $SOURCES')
>
> # Ignores return value
> Action('-build $TARGET $SOURCES')
>
> Hope this helps

It does indeed, thanks. However, using this I realize it isn't quite
what I need:
I want a way to run tests, such that the entire build status doesn't
depend on whether any single test passed or failed. Yet I do want to
handle the test status (so I can report 'PASS' / 'FAIL').

I figure the best way to achieve this is to write my own python function
executing the tests in a subprocess.
However, now I'm faced with a slightly different problem: I want to run
different commands, such as `$SOURCE` in the simplest case, or `$PYTHON
$SOURCE` in a slightly advanced case. How can I explicitly substitute
the variables used in these strings so I can pass this down to
subprocess.call() ?

The documentation explains how certain variables are automatically
substituted by SCons when a command / action is executed. But I didn't
find any hint at how to perform the substitution myself (using
env.subst() ?) when I provide my custom python function.

Thanks,
        Stefan

-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Scons-users mailing list