diff options
author | Steven Knight <knight@baldmt.com> | 2002-06-14 06:00:43 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2002-06-14 06:00:43 (GMT) |
commit | cef5b7fa735eb4e405fab5f852df8e7d53c76954 (patch) | |
tree | ad8e933ac2b3b7c8a8e9ba02bf82b3b93bc73cdb | |
parent | 8facc7d3e757ab88aacd8d430fd7319d13d8a558 (diff) | |
download | SCons-cef5b7fa735eb4e405fab5f852df8e7d53c76954.zip SCons-cef5b7fa735eb4e405fab5f852df8e7d53c76954.tar.gz SCons-cef5b7fa735eb4e405fab5f852df8e7d53c76954.tar.bz2 |
Accomodate '-' (and other characters) in #include files in the C Scanner.
-rw-r--r-- | src/CHANGES.txt | 3 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/C.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/CTests.py | 25 |
3 files changed, 19 insertions, 11 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 82627e3..e65a5ce 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -44,6 +44,9 @@ RELEASE 0.08 - - Add a dependency Scanner for native Fortran "include" statements, using a new "F77PATH" construction variable. + - Fix C #include scanning to detect file names with characters like + '-' in them. + From Jeff Petkau: - Fix --implicit-cache if the scanner returns an empty list. diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index 77b9525..b54c851 100644 --- a/src/engine/SCons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -40,7 +40,7 @@ import SCons.Scanner import SCons.Util import SCons.Warnings -include_re = re.compile('^[ \t]*#[ \t]*include[ \t]+(<|")([\\w./\\\\]+)(>|")', re.M) +include_re = re.compile('^[ \t]*#[ \t]*include[ \t]+(<|")([^>"]+)(>|")', re.M) def CScan(fs = SCons.Node.FS.default_fs): """Return a prototype Scanner instance for scanning source files diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index cc9e116..faa4cdd 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -63,11 +63,11 @@ int main() test.write('f3.cpp',""" #include \t "f1.h" \t #include "f2.h" -# \t include "f3.h" +# \t include "f3-test.h" #include \t <d1/f1.h> \t #include <d1/f2.h> -# \t include <d1/f3.h> +# \t include <d1/f3-test.h> // #include "never.h" @@ -84,9 +84,9 @@ int main() test.subdir('d1', ['d1', 'd2']) -headers = ['f1.h','f2.h', 'f3.h', 'fi.h', 'fj.h', 'never.h', - 'd1/f1.h', 'd1/f2.h', 'd1/f3.h', 'd1/fi.h', 'd1/fj.h', - 'd1/d2/f1.h', 'd1/d2/f2.h', 'd1/d2/f3.h', +headers = ['f1.h','f2.h', 'f3-test.h', 'fi.h', 'fj.h', 'never.h', + 'd1/f1.h', 'd1/f2.h', 'd1/f3-test.h', 'd1/fi.h', 'd1/fj.h', + 'd1/d2/f1.h', 'd1/d2/f2.h', 'd1/d2/f3-test.h', 'd1/d2/f4.h', 'd1/d2/fi.h', 'd1/d2/fj.h'] for h in headers: @@ -96,7 +96,7 @@ test.write('f2.h',""" #include "fi.h" """) -test.write('f3.h',""" +test.write('f3-test.h',""" #include <fj.h> """) @@ -145,9 +145,14 @@ class DummyEnvironment: def __delitem__(self,key): del self.Dictionary()[key] +my_normpath = os.path.normpath +if os.path.normcase('foo') == os.path.normcase('FOO'): + global my_normpath + my_normpath = os.path.normcase + def deps_match(self, deps, headers): - scanned = map(os.path.normpath, map(str, deps)) - expect = map(os.path.normpath, headers) + scanned = map(my_normpath, map(str, deps)) + expect = map(my_normpath, headers) self.failUnless(scanned == expect, "expect %s != scanned %s" % (expect, scanned)) def make_node(filename, fs=SCons.Node.FS.default_fs): @@ -197,8 +202,8 @@ class CScannerTestCase5(unittest.TestCase): # scanned, essential for cooperation with BuildDir functionality. assert SCons.Node.FS.default_fs.File(test.workpath('f3.cpp')).created - headers = ['d1/f1.h', 'd1/f2.h', 'd1/f3.h', - 'f1.h', 'f2.h', 'f3.h', 'fi.h', 'fj.h'] + headers = ['d1/f1.h', 'd1/f2.h', 'd1/f3-test.h', + 'f1.h', 'f2.h', 'f3-test.h', 'fi.h', 'fj.h'] deps_match(self, deps, map(test.workpath, headers)) class CScannerTestCase6(unittest.TestCase): |