summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-12-13 04:42:05 (GMT)
committerSteven Knight <knight@baldmt.com>2001-12-13 04:42:05 (GMT)
commitc81b4be9b7a06dc41cc1f425887d4600fa47f0bc (patch)
treea800b193675c98825b6af007b88b1fb51c41c3e4 /src/engine/SCons/Scanner
parentb9f370f232001d693f10279a3bcff8a0e66eb303 (diff)
downloadSCons-c81b4be9b7a06dc41cc1f425887d4600fa47f0bc.zip
SCons-c81b4be9b7a06dc41cc1f425887d4600fa47f0bc.tar.gz
SCons-c81b4be9b7a06dc41cc1f425887d4600fa47f0bc.tar.bz2
Bug fixes for Scanner handling of subdirectories and Environment copying, courtesy Charles Crain.
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r--src/engine/SCons/Scanner/C.py5
-rw-r--r--src/engine/SCons/Scanner/CTests.py25
2 files changed, 26 insertions, 4 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index 589aef6..8ad7e00 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -106,10 +106,9 @@ def scan(filename, env, args = [SCons.Node.FS.default_fs, ()]):
dir = os.path.dirname(filename)
if dir:
- source_dir = (fs.Dir(dir),)
+ source_dir = (fs.Dir(dir, fs.Top),)
else:
- source_dir = ()
-
+ source_dir = ( fs.Top, )
return (SCons.Util.find_files(angle_includes, cpppath + source_dir,
fs.File)
+ SCons.Util.find_files(quote_includes, source_dir + cpppath,
diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py
index ca4abf0..bc30fa4 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -206,7 +206,7 @@ class CScannerTestCase7(unittest.TestCase):
dict = {}
dict[s1] = 777
assert dict[s2] == 777
-
+
class CScannerTestCase8(unittest.TestCase):
def runTest(self):
fs = SCons.Node.FS.FS(test.workpath(''))
@@ -220,6 +220,27 @@ class CScannerTestCase8(unittest.TestCase):
deps_match(self, deps1, headers1)
deps_match(self, deps2, headers2)
+class CScannerTestCase9(unittest.TestCase):
+ def runTest(self):
+ fs = SCons.Node.FS.FS(test.workpath(''))
+ s = SCons.Scanner.C.CScan(fs=fs)
+ env = DummyEnvironment([])
+ test.write('fa.h','\n')
+ deps = s.instance(env).scan('fa.cpp', None)
+ deps_match(self, deps, [ 'fa.h' ])
+ test.unlink('fa.h')
+
+class CScannerTestCase10(unittest.TestCase):
+ def runTest(self):
+ fs = SCons.Node.FS.FS(test.workpath(''))
+ fs.chdir(fs.Dir('include'))
+ s = SCons.Scanner.C.CScan(fs=fs)
+ env = DummyEnvironment([])
+ test.write('include/fa.cpp', test.read('fa.cpp'))
+ deps = s.instance(env).scan('include/fa.cpp', None)
+ deps_match(self, deps, [ 'include/fa.h', 'include/fb.h' ])
+ test.unlink('include/fa.cpp')
+
def suite():
suite = unittest.TestSuite()
suite.addTest(CScannerTestCase1())
@@ -230,6 +251,8 @@ def suite():
suite.addTest(CScannerTestCase6())
suite.addTest(CScannerTestCase7())
suite.addTest(CScannerTestCase8())
+ suite.addTest(CScannerTestCase9())
+ suite.addTest(CScannerTestCase10())
return suite
if __name__ == "__main__":