summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Node/FS.py7
-rw-r--r--src/engine/SCons/Node/FSTests.py4
-rw-r--r--src/engine/SCons/Script/__init__.py5
3 files changed, 13 insertions, 3 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index aa6482d..fac9627 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -688,6 +688,13 @@ class Dir(Entry):
self._sconsign = SCons.Sig.SConsignFile(self)
return self._sconsign
+ def srcnode(self):
+ """Dir has a special need for srcnode()...if we
+ have a srcdir attribute set, then that *is* our srcnode."""
+ if self.srcdir:
+ return self.srcdir
+ return Entry.srcnode(self)
+
# XXX TODO?
# base_suf
# suffix
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 1610ec6..8f9f5e4 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -82,15 +82,19 @@ class BuildDirTestCase(unittest.TestCase):
f1 = fs.File('build/test1')
fs.BuildDir('build', 'src')
f2 = fs.File('build/test2')
+ d1 = fs.Dir('build')
assert f1.srcnode().path == os.path.normpath('src/test1'), f1.srcnode().path
assert f2.srcnode().path == os.path.normpath('src/test2'), f2.srcnode().path
+ assert d1.srcnode().path == 'src', d1.srcnode().path
fs = SCons.Node.FS.FS()
f1 = fs.File('build/test1')
fs.BuildDir('build', '.')
f2 = fs.File('build/test2')
+ d1 = fs.Dir('build')
assert f1.srcnode().path == 'test1', f1.srcnode().path
assert f2.srcnode().path == 'test2', f2.srcnode().path
+ assert d1.srcnode().path == '.', d1.srcnode().path
fs = SCons.Node.FS.FS()
fs.BuildDir('build/var1', 'src')
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index a0bab35..fd43b9a 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -997,9 +997,8 @@ def _main():
# -U with default targets
default_targets = SCons.Script.SConscript.default_targets
def check_dir(x):
- reps = SCons.Node.FS.default_fs.Rsearchall(str(x.cwd), must_exist=0,
- clazz=SCons.Node.FS.Dir)
- return target_top in reps
+ cwd = x.cwd.srcnode()
+ return cwd == target_top
default_targets = filter(check_dir, default_targets)
SCons.Script.SConscript.default_targets = default_targets
target_top = None