summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2007-05-18 05:40:31 (GMT)
committerSteven Knight <knight@baldmt.com>2007-05-18 05:40:31 (GMT)
commit691da3ed8ba25b0e776d83b4404993925a876071 (patch)
tree4d532be0f91384214c930e1150d7e6becd44a92d /src/engine/SCons/Scanner
parentf020c85e62e3e5c53c2b09a803baac67c06ff14a (diff)
downloadSCons-691da3ed8ba25b0e776d83b4404993925a876071.zip
SCons-691da3ed8ba25b0e776d83b4404993925a876071.tar.gz
SCons-691da3ed8ba25b0e776d83b4404993925a876071.tar.bz2
Merged revisions 1884-1905 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core ........ r1891 | stevenknight | 2007-04-24 08:57:03 -0500 (Tue, 24 Apr 2007) | 1 line 0.96.D632 - Fix 0.96.96 reference count regression during parallel builds. ........ r1892 | stevenknight | 2007-04-24 12:51:05 -0500 (Tue, 24 Apr 2007) | 1 line 0.96.D633 - Fix documented default value(s) of $MSVS_USE_MFC_DIRS. ........ r1893 | stevenknight | 2007-04-24 16:12:14 -0500 (Tue, 24 Apr 2007) | 1 line 0.96.D634 - Make the DirEntryScanner tolerant of non-Dir nodes. ........ r1898 | stevenknight | 2007-05-09 15:07:15 -0500 (Wed, 09 May 2007) | 1 line 0.96.D635 - Portability fixes in test scripts. ........ r1899 | stevenknight | 2007-05-12 08:19:13 -0500 (Sat, 12 May 2007) | 1 line 0.96.D636 - Update documentation with rudimentary Tool module descriptions. ........ r1901 | stevenknight | 2007-05-17 14:32:14 -0500 (Thu, 17 May 2007) | 1 line 0.97.D001 - Initialize 0.97 for release. ........
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r--src/engine/SCons/Scanner/Dir.py12
-rw-r--r--src/engine/SCons/Scanner/DirTests.py15
2 files changed, 21 insertions, 6 deletions
diff --git a/src/engine/SCons/Scanner/Dir.py b/src/engine/SCons/Scanner/Dir.py
index 535150a..9203fb2 100644
--- a/src/engine/SCons/Scanner/Dir.py
+++ b/src/engine/SCons/Scanner/Dir.py
@@ -92,6 +92,14 @@ def scan_in_memory(node, env, path=()):
"""
"Scans" a Node.FS.Dir for its in-memory entries.
"""
- entry_list = filter(do_not_scan, node.entries.keys())
+ try:
+ entries = node.entries
+ except AttributeError:
+ # It's not a Node.FS.Dir (or doesn't look enough like one for
+ # our purposes), which can happen if a target list containing
+ # mixed Node types (Dirs and Files, for example) has a Dir as
+ # the first entry.
+ return []
+ entry_list = filter(do_not_scan, entries.keys())
entry_list.sort()
- return map(lambda n, e=node.entries: e[n], entry_list)
+ return map(lambda n, e=entries: e[n], entry_list)
diff --git a/src/engine/SCons/Scanner/DirTests.py b/src/engine/SCons/Scanner/DirTests.py
index 0dde95e..5f180bc 100644
--- a/src/engine/SCons/Scanner/DirTests.py
+++ b/src/engine/SCons/Scanner/DirTests.py
@@ -50,6 +50,8 @@ class DummyEnvironment:
return self.fs.Dir(name)
def Entry(self, name):
return self.fs.Entry(name)
+ def File(self, name):
+ return self.fs.File(name)
def get_factory(self, factory):
return factory or self.fs.Entry
@@ -77,7 +79,7 @@ class DirScannerTestBase(unittest.TestCase):
self.test.write(['dir', 'sub', '.sconsign.dir'], "dir/.sconsign.dir\n")
self.test.write(['dir', 'sub', '.sconsign.pag'], "dir/.sconsign.pag\n")
-class DirScannerTestCase1(DirScannerTestBase):
+class DirScannerTestCase(DirScannerTestBase):
def runTest(self):
env = DummyEnvironment(self.test.workpath())
@@ -100,7 +102,7 @@ class DirScannerTestCase1(DirScannerTestBase):
sss = map(str, deps)
assert sss == expect, sss
-class DirScannerTestCase2(DirScannerTestBase):
+class DirEntryScannerTestCase(DirScannerTestBase):
def runTest(self):
env = DummyEnvironment(self.test.workpath())
@@ -114,10 +116,15 @@ class DirScannerTestCase2(DirScannerTestBase):
sss = map(str, deps)
assert sss == [], sss
+ # Make sure we don't blow up if handed a non-Dir node.
+ deps = s(env.File('dir/f1'), env, ())
+ sss = map(str, deps)
+ assert sss == [], sss
+
def suite():
suite = unittest.TestSuite()
- suite.addTest(DirScannerTestCase1())
- suite.addTest(DirScannerTestCase2())
+ suite.addTest(DirScannerTestCase())
+ suite.addTest(DirEntryScannerTestCase())
return suite
if __name__ == "__main__":