summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-07-29 23:22:50 (GMT)
committerSteven Knight <knight@baldmt.com>2002-07-29 23:22:50 (GMT)
commit7b142dbd32c3673ae57bda1fea98a8d8e3f7d0e5 (patch)
tree852f6c632d1f018e22d22aa459f2c9753c66ba59 /src/engine/SCons/Scanner
parentcd6d3c9e4f76592845cf32e11cee9a04c1b2f0f6 (diff)
downloadSCons-7b142dbd32c3673ae57bda1fea98a8d8e3f7d0e5.zip
SCons-7b142dbd32c3673ae57bda1fea98a8d8e3f7d0e5.tar.gz
SCons-7b142dbd32c3673ae57bda1fea98a8d8e3f7d0e5.tar.bz2
Multiple directory .h includes in Repositories.
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r--src/engine/SCons/Scanner/C.py4
-rw-r--r--src/engine/SCons/Scanner/CTests.py35
-rw-r--r--src/engine/SCons/Scanner/Fortran.py4
-rw-r--r--src/engine/SCons/Scanner/FortranTests.py25
4 files changed, 60 insertions, 8 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index d37bda8..f388b63 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -81,14 +81,14 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs):
if not hasattr(target, 'cpppath'):
def Dir(x, dir=target.cwd, fs=fs): return fs.Dir(x,dir)
try:
- target.cpppath = tuple(SCons.Node.arg2nodes(env['CPPPATH'],Dir))
+ target.cpppath = tuple(fs.Rsearchall(env['CPPPATH'], Dir))
except KeyError:
target.cpppath = ()
cpppath = target.cpppath
if not node.found_includes.has_key(cpppath):
- if node.exists():
+ if node.rexists():
# cache the includes list in node so we only scan it once:
if node.includes != None:
diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py
index faa4cdd..8a70134 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -113,10 +113,25 @@ int main()
}
""")
-test.write('include/fa.h', "\n")
-test.write('include/fb.h', "\n")
-test.write('subdir/include/fa.h', "\n")
-test.write('subdir/include/fb.h', "\n")
+test.write(['include', 'fa.h'], "\n")
+test.write(['include', 'fb.h'], "\n")
+test.write(['subdir', 'include', 'fa.h'], "\n")
+test.write(['subdir', 'include', 'fb.h'], "\n")
+
+
+test.subdir('repository', ['repository', 'include'])
+test.subdir('work', ['work', 'src'])
+
+test.write(['repository', 'include', 'iii.h'], "\n")
+
+test.write(['work', 'src', 'fff.c'], """
+#include <iii.h>
+
+int main()
+{
+ return 0;
+}
+""")
# define some helpers:
@@ -267,6 +282,17 @@ class CScannerTestCase10(unittest.TestCase):
deps_match(self, deps, [ 'include/fa.h', 'include/fb.h' ])
test.unlink('include/fa.cpp')
+class CScannerTestCase11(unittest.TestCase):
+ def runTest(self):
+ os.chdir(test.workpath('work'))
+ fs = SCons.Node.FS.FS(test.workpath('work'))
+ fs.Repository(test.workpath('repository'))
+ s = SCons.Scanner.C.CScan(fs=fs)
+ env = DummyEnvironment(['include'])
+ deps = s.scan(fs.File('src/fff.c'), env, DummyTarget())
+ deps_match(self, deps, [test.workpath('repository/include/iii.h')])
+ os.chdir(test.workpath(''))
+
def suite():
suite = unittest.TestSuite()
suite.addTest(CScannerTestCase1())
@@ -278,6 +304,7 @@ def suite():
suite.addTest(CScannerTestCase8())
suite.addTest(CScannerTestCase9())
suite.addTest(CScannerTestCase10())
+ suite.addTest(CScannerTestCase11())
return suite
if __name__ == "__main__":
diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py
index 17c9241..e87b885 100644
--- a/src/engine/SCons/Scanner/Fortran.py
+++ b/src/engine/SCons/Scanner/Fortran.py
@@ -79,7 +79,7 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs):
if not hasattr(target, 'f77path'):
def Dir(x, dir=target.cwd, fs=fs): return fs.Dir(x,dir)
try:
- target.f77path = tuple(SCons.Node.arg2nodes(env['F77PATH'],Dir))
+ target.f77path = tuple(fs.Rsearchall(env['F77PATH'], Dir))
except KeyError:
target.f77path = ()
@@ -90,7 +90,7 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs):
try:
nodes = node.found_includes[f77path]
except KeyError:
- if node.exists():
+ if node.rexists():
# cache the includes list in node so we only scan it once:
if node.includes != None:
diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py
index 2883daf..6d2a066 100644
--- a/src/engine/SCons/Scanner/FortranTests.py
+++ b/src/engine/SCons/Scanner/FortranTests.py
@@ -92,6 +92,19 @@ test.write('fff4.f',"""
test.write('include/f4.f', "\n")
test.write('subdir/include/f4.f', "\n")
+
+test.subdir('repository', ['repository', 'include'])
+test.subdir('work', ['work', 'src'])
+
+test.write(['repository', 'include', 'iii.f'], "\n")
+
+test.write(['work', 'src', 'fff.f'], """
+ PROGRAM FOO
+ INCLUDE 'iii.f'
+ STOP
+ END
+""")
+
# define some helpers:
class DummyTarget:
@@ -278,6 +291,17 @@ class FortranScannerTestCase12(unittest.TestCase):
deps_match(self, deps, ['include/f4.f'])
test.unlink('include/fff4.f')
+class FortranScannerTestCase13(unittest.TestCase):
+ def runTest(self):
+ os.chdir(test.workpath('work'))
+ fs = SCons.Node.FS.FS(test.workpath('work'))
+ fs.Repository(test.workpath('repository'))
+ s = SCons.Scanner.Fortran.FortranScan(fs=fs)
+ env = DummyEnvironment(['include'])
+ deps = s.scan(fs.File('src/fff.f'), env, DummyTarget())
+ deps_match(self, deps, [test.workpath('repository/include/iii.f')])
+ os.chdir(test.workpath(''))
+
def suite():
suite = unittest.TestSuite()
suite.addTest(FortranScannerTestCase1())
@@ -292,6 +316,7 @@ def suite():
suite.addTest(FortranScannerTestCase10())
suite.addTest(FortranScannerTestCase11())
suite.addTest(FortranScannerTestCase12())
+ suite.addTest(FortranScannerTestCase13())
return suite
if __name__ == "__main__":