summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/FS.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-03-30 16:55:46 (GMT)
committerSteven Knight <knight@baldmt.com>2003-03-30 16:55:46 (GMT)
commit786aa89ee387927f0ef142f3328b3c0eebb1da5a (patch)
tree8e8f86ec954f00dfba25179cb0257db9369c3b66 /src/engine/SCons/Node/FS.py
parentd3ce17c54525be85011f667f584611cc02ee9a11 (diff)
downloadSCons-786aa89ee387927f0ef142f3328b3c0eebb1da5a.zip
SCons-786aa89ee387927f0ef142f3328b3c0eebb1da5a.tar.gz
SCons-786aa89ee387927f0ef142f3328b3c0eebb1da5a.tar.bz2
Fix a bug when BuildDir(duplicate=0) is used with multiple SConscript files. (Charles Crain)
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
-rw-r--r--src/engine/SCons/Node/FS.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 0afc3d8..f380f7e 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -557,10 +557,15 @@ class FS:
to match.
"""
self.__setTopLevelDir()
- if not dir is None:
- self._cwd = dir
- if change_os_dir:
- os.chdir(dir.abspath)
+ curr=self._cwd
+ try:
+ if not dir is None:
+ self._cwd = dir
+ if change_os_dir:
+ os.chdir(dir.abspath)
+ except:
+ self._cwd = curr
+ raise
def Entry(self, name, directory = None, create = 1, klass=None):
"""Lookup or create a generic Entry node with the specified name.
@@ -640,6 +645,13 @@ class FS:
n = self.__doLookup(clazz, name, d)
if n.exists():
return n
+ if isinstance(n, Dir):
+ # If n is a Directory that has Repositories directly
+ # attached to it, then any of those is a valid Repository
+ # path. Return the first one that exists.
+ reps = filter(lambda x: x.exists(), n.getRepositories())
+ if len(reps):
+ return reps[0]
d = n.get_dir()
name = n.name
# Search repositories of all directories that this file is under.