More efficient Node.FS.Dir.current() check. Fix some Windows test portability issues.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 21 Jan 2006 15:22:29 +0000 (15:22 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 21 Jan 2006 15:22:29 +0000 (15:22 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1412 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Node/FS.py
test/AR/ARCOMSTR.py
test/RANLIB/RANLIBCOM.py
test/RANLIB/RANLIBCOMSTR.py

index d9282ea3149a17a863b739e17aadcf8dd757e548..a0a7a44953331af1d303eff33b44e8d2b3d389d3 100644 (file)
@@ -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__"
index f20adb52fb368435bb7788ff6115be76e3bb114e..ae63ea06981abcbf6522b887c99d544aa3b68366 100644 (file)
@@ -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")
 
index 25f2f612946590bc882be6010703a021eca96c30..d60a14ef7980c3ea8889dd3d639fb9468324e5b1 100644 (file)
@@ -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', """
index 4e348c0604bb042237b5915d5bc61b8e43de0700..4e0367588ccda40231a93844b28c78f5bc7c64e2 100644 (file)
@@ -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', """