summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Script/SConscript.py
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 /src/engine/SCons/Script/SConscript.py
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.
Diffstat (limited to 'src/engine/SCons/Script/SConscript.py')
-rw-r--r--src/engine/SCons/Script/SConscript.py13
1 files changed, 11 insertions, 2 deletions
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