From 755f8597d241b1e33d69e6ceb84a59b41ee3d132 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 21 Jan 2006 15:22:29 +0000 Subject: [PATCH] More efficient Node.FS.Dir.current() check. Fix some Windows test portability issues. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1412 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Node/FS.py | 17 ++++++----------- test/AR/ARCOMSTR.py | 9 +++++---- test/RANLIB/RANLIBCOM.py | 5 +++++ test/RANLIB/RANLIBCOMSTR.py | 5 +++++ 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index d9282ea3..a0a7a449 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1377,20 +1377,15 @@ class Dir(Base): pass def current(self, calc=None): - """If all of our children were up-to-date, then this - directory was up-to-date, too.""" + """If any child is not up-to-date, then this directory isn't, + either.""" if not self.builder is MkdirBuilder and not self.exists(): return 0 - state = 0 + up_to_date = SCons.Node.up_to_date for kid in self.children(): - s = kid.get_state() - if s and (not state or s > state): - state = s - import SCons.Node - if state == 0 or state == SCons.Node.up_to_date: - return 1 - else: - return 0 + if kid.get_state() > up_to_date: + return 0 + return 1 def rdir(self): "__cacheable__" diff --git a/test/AR/ARCOMSTR.py b/test/AR/ARCOMSTR.py index f20adb52..ae63ea06 100644 --- a/test/AR/ARCOMSTR.py +++ b/test/AR/ARCOMSTR.py @@ -30,6 +30,7 @@ the displayed archiver string. """ import TestSCons +import string python = TestSCons.python @@ -63,10 +64,10 @@ env.Library(target = 'output', source = ['file.1', 'file.2']) test.write('file.1', "file.1\n/*ar*/\n") test.write('file.2', "file.2\n/*ar*/\n") -test.run(stdout = test.wrap_stdout("""\ -Archiving output.lib from file.1 file.2 -%s myranlib.py output.lib -""" % python)) +test.run() + +expect = 'Archiving output.lib from file.1 file.2' +test.fail_test(string.find(test.stdout(), expect) == -1) test.must_match('output.lib', "file.1\nfile.2\n") diff --git a/test/RANLIB/RANLIBCOM.py b/test/RANLIB/RANLIBCOM.py index 25f2f612..d60a14ef 100644 --- a/test/RANLIB/RANLIBCOM.py +++ b/test/RANLIB/RANLIBCOM.py @@ -34,6 +34,11 @@ python = TestSCons.python test = TestSCons.TestSCons() +ranlib = test.detect('RANLIB', 'ranlib') + +if not ranlib: + test.skip_test("Could not find 'ranlib', skipping test.\n") + test.write('myar.py', """ diff --git a/test/RANLIB/RANLIBCOMSTR.py b/test/RANLIB/RANLIBCOMSTR.py index 4e348c06..4e036758 100644 --- a/test/RANLIB/RANLIBCOMSTR.py +++ b/test/RANLIB/RANLIBCOMSTR.py @@ -35,6 +35,11 @@ python = TestSCons.python test = TestSCons.TestSCons() +ranlib = test.detect('RANLIB', 'ranlib') + +if not ranlib: + test.skip_test("Could not find 'ranlib', skipping test.\n") + test.write('myar.py', """ -- 2.26.2