From b7bec87e9a2709e7e33f276598ee9160245f02d7 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Tue, 12 Nov 2002 10:42:12 +0000 Subject: [PATCH] Fix scans for derived include files in Repositories. (Charles Crain) git-svn-id: http://scons.tigris.org/svn/scons/trunk@494 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- etc/SConscript | 4 +++- src/CHANGES.txt | 2 +- src/engine/SCons/Scanner/C.py | 2 +- src/engine/SCons/Scanner/CTests.py | 10 ++++++++-- src/engine/SCons/Scanner/Fortran.py | 2 +- src/engine/SCons/Scanner/FortranTests.py | 10 ++++++++-- 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/etc/SConscript b/etc/SConscript index 96a464d1..adac43e6 100644 --- a/etc/SConscript +++ b/etc/SConscript @@ -48,4 +48,6 @@ for file in files: p = os.path.join('build', 'etc', file) if os.path.islink(p): os.unlink(p) - env.Command(os.path.join('#' + p), file, copy) + sp = '#' + p + env.Command(sp, file, copy) + Local(sp) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 83c0d08f..a313b09c 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -17,7 +17,7 @@ RELEASE 0.09 - From Charles Crain and Steven Knight: - - Add Repository() functionality. + - Add Repository() functionality, including the -Y option. From Steven Knight: diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index 0e6e5d38..6eb03f4b 100644 --- a/src/engine/SCons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -80,7 +80,7 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs): if not hasattr(target, 'cpppath'): try: - target.cpppath = tuple(fs.Rsearchall(SCons.Util.mapPaths(env['CPPPATH'], target.cwd), clazz=SCons.Node.FS.Dir)) + target.cpppath = tuple(fs.Rsearchall(SCons.Util.mapPaths(env['CPPPATH'], target.cwd), clazz=SCons.Node.FS.Dir, must_exist=0)) except KeyError: target.cpppath = () diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index b91200f2..be911d9e 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -127,6 +127,7 @@ test.write(['repository', 'include', 'iii.h'], "\n") test.write(['work', 'src', 'fff.c'], """ #include +#include int main() { @@ -319,10 +320,15 @@ class CScannerTestCase11(unittest.TestCase): os.chdir(test.workpath('work')) fs = SCons.Node.FS.FS(test.workpath('work')) fs.Repository(test.workpath('repository')) + + # Create a derived file in a directory that does not exist yet. + # This was a bug at one time. + f1=fs.File('include2/jjj.h') + f1.builder=1 s = SCons.Scanner.C.CScan(fs=fs) - env = DummyEnvironment(['include']) + env = DummyEnvironment(['include', 'include2']) deps = s.scan(fs.File('src/fff.c'), env, DummyTarget()) - deps_match(self, deps, [test.workpath('repository/include/iii.h')]) + deps_match(self, deps, [ test.workpath('repository/include/iii.h'), 'include2/jjj.h' ]) os.chdir(test.workpath('')) class CScannerTestCase12(unittest.TestCase): diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py index 5c4f69dd..afe46d09 100644 --- a/src/engine/SCons/Scanner/Fortran.py +++ b/src/engine/SCons/Scanner/Fortran.py @@ -78,7 +78,7 @@ def scan(node, env, target, fs = SCons.Node.FS.default_fs): if not hasattr(target, 'f77path'): try: - target.f77path = tuple(fs.Rsearchall(SCons.Util.mapPaths(env['F77PATH'], target.cwd), clazz=SCons.Node.FS.Dir)) + target.f77path = tuple(fs.Rsearchall(SCons.Util.mapPaths(env['F77PATH'], target.cwd), clazz=SCons.Node.FS.Dir, must_exist=0)) except KeyError: target.f77path = () diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py index 9806d60f..3e3f7da6 100644 --- a/src/engine/SCons/Scanner/FortranTests.py +++ b/src/engine/SCons/Scanner/FortranTests.py @@ -102,6 +102,7 @@ test.write(['repository', 'include', 'iii.f'], "\n") test.write(['work', 'src', 'fff.f'], """ PROGRAM FOO INCLUDE 'iii.f' + INCLUDE 'jjj.f' STOP END """) @@ -323,10 +324,15 @@ class FortranScannerTestCase13(unittest.TestCase): os.chdir(test.workpath('work')) fs = SCons.Node.FS.FS(test.workpath('work')) fs.Repository(test.workpath('repository')) + + # Create a derived file in a directory that does not exist yet. + # This was a bug at one time. + f1=fs.File('include2/jjj.f') + f1.builder=1 s = SCons.Scanner.Fortran.FortranScan(fs=fs) - env = DummyEnvironment(['include']) + env = DummyEnvironment(['include','include2']) deps = s.scan(fs.File('src/fff.f'), env, DummyTarget()) - deps_match(self, deps, [test.workpath('repository/include/iii.f')]) + deps_match(self, deps, [test.workpath('repository/include/iii.f'), 'include2/jjj.f']) os.chdir(test.workpath('')) class FortranScannerTestCase14(unittest.TestCase): -- 2.26.2