[Scons-users] Getting directory in which Sconscript is running

Gary Oberbrunner garyo at oberbrunner.com
Thu May 1 12:42:10 EDT 2014


On Thu, May 1, 2014 at 12:33 PM, Tom Tanner (BLOOMBERG/ LONDON)
<ttanner2 at bloomberg.net> wrote:

> I need to run a python script which needs a python path specified. The

> python modules are in a subdirectory of where the sconscript is running.

>

> so this'd involve

>

> PYTHONPATH=<path-to-repo>/A/B $SOURCES $TARGETS


I assume that's a shell command you're going to run with Command().


> as the source is a repository (which might live in different locations for

> different users) all the paths are absolute, so I thought it'd be easier to

> pass them in by setting env['ENV']['PYTHONPATH'] rather than putting

> PYTHONPATH=$(path to repo$}/A/B in the command. I might be wrong.


Maybe try this:

PYTHONPATH=<path-to-repo>/${Dir('.')} $SOURCES $TARGETS

or if that doesn't work:

env.Command(targets, sources, 'PYTHONPATH=<path-to-repo>/$MYDIR
$SOURCES $TARGETS', MYDIR=Dir(.))

--
Gary


More information about the Scons-users mailing list