From d30232456a52a4605f3edfc60ca135d34c88689e Mon Sep 17 00:00:00 2001 From: stevenknight Date: Thu, 29 Jan 2004 06:57:54 +0000 Subject: [PATCH] Fetch implicit dependencies from SCCS/RCS. git-svn-id: http://scons.tigris.org/svn/scons/trunk@888 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 3 ++ src/engine/SCons/Node/FS.py | 3 +- src/engine/SCons/Node/FSTests.py | 6 +++- test/RCS.py | 46 +++++++++++++++++++++++++++++++ test/SCCS.py | 47 ++++++++++++++++++++++++++++++++ 5 files changed, 103 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 8b14bf4b..b66333d1 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -147,6 +147,9 @@ RELEASE 0.95 - XXX - Provide a more useful error message if a construction variable expansion contains a syntax error during evaluation. + - Fix transparent checkout of implicit dependency files from SCCS + and RCS. + From Vincent Risi: - Add support for the bcc32, ilink32 and tlib Borland tools. diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 46d72d75..cbfe396f 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1543,8 +1543,9 @@ def find_file(filename, paths, node_factory = default_fs.File): for dir in paths: try: node = node_factory(filename, dir) - # Return true of the node exists or is a derived node. + # Return true if the node exists or is a derived node. if node.is_derived() or \ + node.is_pseudo_derived() or \ (isinstance(node, SCons.Node.FS.Base) and node.exists()): retval = node break diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 132e8f61..ef1f52aa 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -1373,13 +1373,17 @@ class find_fileTestCase(unittest.TestCase): os.chdir(test.workpath("")) # FS doesn't like the cwd to be something other than it's root node_derived = fs.File(test.workpath('bar/baz')) node_derived.builder_set(1) # Any non-zero value. + node_pseudo = fs.File(test.workpath('pseudo')) + node_pseudo.set_src_builder(1) # Any non-zero value. paths = map(fs.Dir, ['.', './bar']) nodes = [SCons.Node.FS.find_file('foo', paths, fs.File), - SCons.Node.FS.find_file('baz', paths, fs.File)] + SCons.Node.FS.find_file('baz', paths, fs.File), + SCons.Node.FS.find_file('pseudo', paths, fs.File)] file_names = map(str, nodes) file_names = map(os.path.normpath, file_names) assert os.path.normpath('./foo') in file_names, file_names assert os.path.normpath('./bar/baz') in file_names, file_names + assert os.path.normpath('./pseudo') in file_names, file_names class StringDirTestCase(unittest.TestCase): def runTest(self): diff --git a/test/RCS.py b/test/RCS.py index 7be00809..93a985e1 100644 --- a/test/RCS.py +++ b/test/RCS.py @@ -49,6 +49,8 @@ def is_writable(file): mode = os.stat(file)[stat.ST_MODE] return mode & stat.S_IWUSR + + # Test explicit checkouts from local RCS files. test.subdir('work1', ['work1', 'sub']) @@ -137,6 +139,8 @@ test.fail_test(is_writable(test.workpath('work1', 'ccc.in'))) test.fail_test(is_writable(test.workpath('work1', 'sub', 'ddd.in'))) test.fail_test(is_writable(test.workpath('work1', 'sub', 'fff.in'))) + + # Test transparent RCS checkouts from an RCS subdirectory. test.subdir('work2', ['work2', 'RCS'], ['work2', 'sub'], ['work2', 'sub', 'RCS']) @@ -241,5 +245,47 @@ test.fail_test(not is_writable(test.workpath('work2', 'ccc.in'))) test.fail_test(not is_writable(test.workpath('work2', 'sub', 'ddd.in'))) test.fail_test(not is_writable(test.workpath('work2', 'sub', 'fff.in'))) + + +# Test transparent RCS checkouts of implicit dependencies. +test.subdir('work3', ['work3', 'RCS']) + +test.write(['work3', 'foo.c'], """\ +#include "foo.h" +int +main(int argc, char *argv[]) { + printf(STR); + printf("work3/foo.c\\n"); +} +""") +test.run(chdir = 'work3', + program = ci, + arguments = "-f -tfoo.c foo.c", + stderr = None) + +test.write(['work3', 'foo.h'], """\ +#define STR "work3/foo.h\\n" +""") +test.run(chdir = 'work3', + program = ci, + arguments = "-f -tfoo.h foo.h", + stderr = None) + +test.write(['work3', 'SConstruct'], """ +env = Environment() +env.Program('foo.c') +""") + +test.run(chdir='work3', stderr="""\ +RCS/foo.c,v --> foo.c +revision 1.1 +done +RCS/foo.h,v --> foo.h +revision 1.1 +done +""") + + + # test.pass_test() diff --git a/test/SCCS.py b/test/SCCS.py index 3194f4f2..b98e9a73 100644 --- a/test/SCCS.py +++ b/test/SCCS.py @@ -44,6 +44,8 @@ def is_writable(file): mode = os.stat(file)[stat.ST_MODE] return mode & stat.S_IWUSR + + # Test explicit checkouts from local SCCS files. test.subdir('work1', ['work1', 'sub']) @@ -130,6 +132,8 @@ test.fail_test(not is_writable(test.workpath('work1', 'ccc.in'))) test.fail_test(not is_writable(test.workpath('work1', 'sub', 'ddd.in'))) test.fail_test(not is_writable(test.workpath('work1', 'sub', 'fff.in'))) + + # Test transparent checkouts from SCCS files in an SCCS subdirectory. test.subdir('work2', ['work2', 'SCCS'], ['work2', 'sub'], ['work2', 'sub', 'SCCS']) @@ -215,4 +219,47 @@ test.fail_test(is_writable(test.workpath('work2', 'ccc.in'))) test.fail_test(is_writable(test.workpath('work2', 'sub', 'ddd.in'))) test.fail_test(is_writable(test.workpath('work2', 'sub', 'fff.in'))) + + + +# Test transparent SCCS checkouts of implicit dependencies. +test.subdir('work3', ['work3', 'SCCS']) + +test.write(['work3', 'foo.c'], """\ +#include "foo.h" +int +main(int argc, char *argv[]) { + printf(STR); + printf("work3/foo.c\\n"); +} +""") +test.run(chdir = 'work3', + program = sccs, + arguments = "create foo.c", + stderr = None) +test.unlink(['work3', 'foo.c']) +test.unlink(['work3', ',foo.c']) + +test.write(['work3', 'foo.h'], """\ +#define STR "work3/foo.h\\n" +""") +test.run(chdir = 'work3', + program = sccs, + arguments = "create foo.h", + stderr = None) +test.unlink(['work3', 'foo.h']) +test.unlink(['work3', ',foo.h']) + +test.write(['work3', 'SConstruct'], """ +env = Environment() +env.Program('foo.c') +""") + +test.run(chdir='work3', stderr = """\ +foo.c 1.1: 6 lines +foo.h 1.1: 1 lines +""") + + + test.pass_test() -- 2.26.2