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

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


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


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


More information about the Scons-users mailing list