[Scons-users] SCons builder to call scripts with other files as arguments

Carnë Draug carandraug+dev at gmail.com
Sun Jan 24 14:15:49 EST 2016


I have many cases where I use scripts and data files in SCons.  At the
moment I'm writing something like this:

    foo_script = 'scripts/mk_foo.py'
    foo = env.Command(source = 'data/foo.json',
                      target = 'results/foo.tex',
                      action = 'python %s $SOURCE > $TARGET')
    env.Depends(foo, foo_script)

This is already not ideal because I have to keep repeating 'foo_script'.
However, my problem is another which I think also solves it.

I have changed the structure of my project and started to make use of
SConscript in subdirectory.  When using a SConscript, SCons builders
are smart enough to fix the path for the declared nodes ("source" and
"target") but obviously not for the actual path of the script.

Short of exporting one more variable from SConstruct and join the paths
myself, how can I do this with SCons?

Carnë


More information about the Scons-users mailing list