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

Tom Tanner (BLOOMBERG/ LONDON) ttanner2 at bloomberg.net
Thu May 1 12:33:15 EDT 2014


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

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.

----- Original Message -----
From: bill at baddogconsulting.com
To: Tom Tanner (BLOOMBERG/ LONDON), scons-users at scons.org
At: May 1 2014 17:25:39

Tom,

Not sure what you're really trying to do, but it sounds ugly.
I've found if it's hard to do, you're probably doing it wrong..

Perhaps you can expand on the what you're trying to do, rather than the 'how you're trying to do it'..

-Bill


On Thu, May 1, 2014 at 9:23 AM, Tom Tanner (BLOOMBERG/ LONDON) <ttanner2 at bloomberg.net> wrote:

I've found half the answer. Dir('.').path gives me A/B

Now I need to find the path of the actual directory that contains the SConscript (I know I can do os.path.dirname(File('SConscript').rstr()) but - that is not pretty)


----- Original Message -----
From: ttanner2 at bloomberg.net
To: scons-users at scons.org
At: May 1 2014 17:19:59

But I don't want to do #A/B. What happens if for some reason, I want to move B (or A). Or want to share code between 2 SConscripts.

----- Original Message -----
From: wblevins001 at gmail.com
To: Tom Tanner (BLOOMBERG/ LONDON), scons-users at scons.org
At: May 1 2014 17:00:00


See scons 2.3.1 user guide 14.3 for more.
On May 1, 2014 11:55 AM, "William Blevins" <wblevins001 at gmail.com> wrote:


The '#' symbol always refers to the SConstruct dir, so you can refer as '#A' join 'B' and files stay relative to the root src dir.
V/R,
William
On May 1, 2014 11:48 AM, "Tom Tanner (BLOOMBERG/ LONDON)" <ttanner2 at bloomberg.net> wrote:


I'd really like to be able to get hold of the current SConscript directory relative to the SConstruct path, so with a directory structure in a repository a little like this:

+-SConstruct

|

+-A

|

+-B

|

+-SConscript

There will be something I can do in the SConscript that will get me "A/B" (i.e. the relative directory in which things will be built), and <wherever the source is>/A/B, which is the sort of thing I need to stuff in environment variable (for instance for getting the right PYTHONPATH for running python scripts which live in a subdirectory of B).

Using Dir('.').rstr() or .rdir() will get you '.'. Throwing srcdir().abspath into the mix will get me the full path to the build directory, not the full path to the source directory.


-------------------------------------------------------------------------------

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users


-------------------------------------------------------------------------------
_______________________________________________ Scons-users mailing list Scons-users at scons.org http://four.pairlist.net/mailman/listinfo/scons-users


-------------------------------------------------------------------------------

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users




-------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140501/738e01f7/attachment.html


More information about the Scons-users mailing list