[Scons-users] SCons stays in top-level directory or not?

Gary Oberbrunner garyo at oberbrunner.com
Fri Feb 8 08:28:04 EST 2013


SCons works in two phases. In the first, it reads all the SConscripts and
builds the dependency graph. In the second, it builds whatever is needed
by executing the graph. The file nodes in the graph know the full path to
each file.

In the first phase, reading the SConscripts, SCons changes into the dir of
each SConscript (variant if that's enabled), so paths relative to the
SConscript work (your "printing ." above). In the second (build) phase,
SCons stays in the top dir and executes all commands with the proper paths
from there.

SCons can be made to cd into each target's dir before executing its
command(s), but that's not recommended because it breaks parallel builds
since any process can only have one current dir across all threads.


On Fri, Feb 8, 2013 at 7:56 AM, Dan Pidcock <dan.pidcock at googlemail.com>wrote:


> The SCons user guide section '14.2 Path Names Are Relative to the

> SConscript Directory' states:

> "Second, unlike standard recursive use of Make, SCons stays in the

> top-level directory (where the SConstruct file lives) and issues

> commands that use the path names from the top-level directory to the

> target and source files within the hierarchy."

>

> Is this correct?

> When I do print os.getcwd() from a SConscript it prints the variant

> directory that the SConscript is in, also

> http://stackoverflow.com/a/1462129/12663 says that printing . in the

> SCons way also prints the variant directory.

>

> Dan

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>




--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130208/69efdc16/attachment.html>


More information about the Scons-users mailing list