summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-03-15 05:30:41 (GMT)
committerSteven Knight <knight@baldmt.com>2003-03-15 05:30:41 (GMT)
commit127d61ac6d0a272bf82cbcaf5923b4ddd302ec7e (patch)
tree518b959654a5e9119b51d229b64a31ca90e4e4f7
parenta5a29f951bbc993337b8d204d95251cab47c65f6 (diff)
downloadSCons-127d61ac6d0a272bf82cbcaf5923b4ddd302ec7e.zip
SCons-127d61ac6d0a272bf82cbcaf5923b4ddd302ec7e.tar.gz
SCons-127d61ac6d0a272bf82cbcaf5923b4ddd302ec7e.tar.bz2
Change the default SConscriptChdir() behavior to NOT chdir to the SConscript directory.
-rw-r--r--doc/man/scons.132
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/RELEASE.txt9
-rw-r--r--src/engine/SCons/Script/SConscript.py13
4 files changed, 44 insertions, 13 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1
index f0845d6..6d84638 100644
--- a/doc/man/scons.1
+++ b/doc/man/scons.1
@@ -3386,24 +3386,34 @@ SConscript('bld/SConscript', src_dir='src', exports='env')
.TP
.RI SConscriptChdir( value )
-When a non-zero
-.I value
-is specified,
-this instructs
+By default,
.B scons
-to change its working directory (chdir)
-to the directory in which each subsidiary
-SConscript file lives.
-Note that you may enable and disable
+changes its working directory
+to the directory in which each
+subsidiary SConscript file lives.
+This behavior may be disabled
+by specifying:
+.ES
+SConscriptChdir(0)
+.EE
+in which case
+.B scons
+will stay in the top-level directory
+while reading all SConscript files.
+(This may be necessary when building from repositories,
+when all the directories in which SConscript files may be found
+don't necessarily exist locally.)
+
+You may enable and disable
this ability by calling
SConscriptChdir()
multiple times:
.ES
-SConscriptChdir(1)
-SConscript('foo/SConscript') # will chdir to foo
SConscriptChdir(0)
-SConscript('bar/SConscript') # will not chdir to bar
+SConscript('foo/SConscript') # will not chdir to foo
+SConscriptChdir(1)
+SConscript('bar/SConscript') # will chdir to bar
.EE
.TP
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index a6406a7..ca480de 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -75,6 +75,9 @@ RELEASE 0.12 - XXX
This allows you to build in another directory by simply changing
there and pointing at the SConstruct file in another directory.
+ - Change the default SConscriptChdir() behavior to change to the
+ SConscript directory while it's being read.
+
From Lachlan O'Dea:
- Add SharedObject() support to the masm tool.
diff --git a/src/RELEASE.txt b/src/RELEASE.txt
index 535384d..8ae7dfb 100644
--- a/src/RELEASE.txt
+++ b/src/RELEASE.txt
@@ -25,6 +25,15 @@ RELEASE 0.12 - XXX
This is the twelfth alpha release of SCons. Please consult the
CHANGES.txt file for a list of specific changes since last release.
+ Please note the following important changes since release 0.11:
+
+ - The default behavior of SCons is now to change to the directory in
+ which an SConscript file resides while reading the SConscript file.
+ To disable this and restore the previous behavior of staying in the
+ top-level directory, specify the following in your SConstruct file:
+
+ SConscriptChdir(0)
+
Please note the following important changes since release 0.10:
- The default suffix for shared object files when using gcc has
diff --git a/src/engine/SCons/Script/SConscript.py b/src/engine/SCons/Script/SConscript.py
index ab071e0..8dd4ef3 100644
--- a/src/engine/SCons/Script/SConscript.py
+++ b/src/engine/SCons/Script/SConscript.py
@@ -61,7 +61,7 @@ launch_dir = os.path.abspath(os.curdir)
global_exports = {}
# chdir flag
-sconscript_chdir = 0
+sconscript_chdir = 1
def SConscriptChdir(flag):
global sconscript_chdir
@@ -232,7 +232,16 @@ def SConscript(*ls, **kw):
# in different Repositories. For now, cross that
# bridge when someone comes to it.
ldir = default_fs.Dir(f.dir.get_path(sd))
- default_fs.chdir(ldir, change_os_dir=sconscript_chdir)
+ try:
+ default_fs.chdir(ldir, change_os_dir=sconscript_chdir)
+ except OSError:
+ # There was no local directory, so we should be
+ # able to chdir to the Repository directory.
+ # Note that we do this directly, not through
+ # default_fs.chdir(), because we still need to
+ # interpret the stuff within the SConscript file
+ # relative to where we are logically.
+ os.chdir(f.rfile().dir.abspath)
# Append the SConscript directory to the beginning
# of sys.path so Python modules in the SConscript