Filter out a file's ignore list from all of its dependencies, direct or indirect.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 12 Feb 2002 17:08:33 +0000 (17:08 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 12 Feb 2002 17:08:33 +0000 (17:08 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@255 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/NodeTests.py
src/engine/SCons/Node/__init__.py
src/engine/SCons/Script/__init__.py
src/engine/SCons/Sig/SigTests.py
src/engine/SCons/Sig/__init__.py

index ae2f487700c70e36ce1c401a7ec5f919eeb701da..d5a073546e2df932d00f7a0a49cb77f3135827cc 100644 (file)
@@ -56,6 +56,9 @@ RELEASE 0.05 -
   - Document the overlooked LIBPATH construction variable.
     (Bug reported by Eicke Godehardt.)
 
+  - Fix so that Ignore() ignores indirect, implicit dependencies
+    (included files), not just direct dependencies.
+
   From Anthony Roach:
 
   - Make the scons script return an error code on failures.
index 4e518603bfd5f9548b97f9b04588b646927f4c66..b999b52a517d965cb4fe195549397f7ed5d01f18 100644 (file)
@@ -423,8 +423,8 @@ class NodeTestCase(unittest.TestCase):
         assert node.scanned[ds] == 1, node.scanned
 
     def test_children(self):
-       """Test fetching the "children" of a Node.
-       """
+        """Test fetching the non-ignored "children" of a Node.
+        """
        node = SCons.Node.Node()
         one = SCons.Node.Node()
         two = SCons.Node.Node()
@@ -435,7 +435,31 @@ class NodeTestCase(unittest.TestCase):
 
         node.add_source([one, two, three])
         node.add_dependency([four, five, six])
+        node.add_ignore([two, five])
         kids = node.children()
+        assert len(kids) == 4
+        assert one in kids
+        assert not two in kids
+        assert three in kids
+        assert four in kids
+        assert not five in kids
+        assert six in kids
+
+    def test_all_children(self):
+        """Test fetching all the "children" of a Node.
+        """
+        node = SCons.Node.Node()
+        one = SCons.Node.Node()
+        two = SCons.Node.Node()
+        three = SCons.Node.Node()
+        four = SCons.Node.Node()
+        five = SCons.Node.Node()
+        six = SCons.Node.Node()
+
+        node.add_source([one, two, three])
+        node.add_dependency([four, five, six])
+        node.add_ignore([two, five])
+        kids = node.all_children()
         assert len(kids) == 6
         assert one in kids
         assert two in kids
index 1d09b20bb74db6b8c9b62f95ab8921a48c75a990..c0de58e1bda07f996216ee0735f696f0a0c8635e 100644 (file)
@@ -228,11 +228,16 @@ class Node:
             self.wkids.append(wkid)
 
     def children(self):
+        """Return a list of the node's direct children, minus those
+        that are ignored by this node."""
+        return filter(lambda x, i=self.ignore: x not in i, self.all_children())
+
+    def all_children(self):
+        """Return a list of all the node's direct children."""
         #XXX Need to remove duplicates from this
-        return filter(lambda x, i=self.ignore: x not in i,
-                      self.sources \
-                      + self.depends \
-                      + reduce(lambda x, y: x + y, self.implicit.values(), []))
+        return self.sources \
+               + self.depends \
+               + reduce(lambda x, y: x + y, self.implicit.values(), [])
 
     def get_parents(self):
         return self.parents
index a34814ed70ab2a3e80d1dc6e45c485ba3759de07..dfd969ec2668847ca86d982e1279c79dc97ec488 100644 (file)
@@ -130,7 +130,7 @@ exit_status = 0 # exit status, assume success by default
 
 # utility functions
 
-def get_children(node): return node.children()
+def get_children(node): return node.all_children()
 
 def _scons_syntax_error(e):
     """Handle syntax errors. Print out a message and show where the error
index e4c9421a2986bf30f1476f715db10af5d809bb75..fba383e60d3d9cf796f322b56d128d13fccb28c1 100644 (file)
@@ -51,6 +51,7 @@ class DummyNode:
         self.path = file.path
         self.builder = file.builder
        self.depends = []
+        self.ignore = []
         self.use_signature = 1
         self.bsig = None
         self.csig = None
@@ -81,6 +82,10 @@ class DummyNode:
             return self.exists_cache
         
     def children(self):
+        return filter(lambda x, i=self.ignore: x not in i,
+                      self.sources + self.depends)
+        
+    def all_children(self):
         return self.sources + self.depends
 
     def current(self):
@@ -288,9 +293,12 @@ class CalcTestCase(unittest.TestCase):
                 self.bsig = bsig
                 self.csig = csig
                 self.kids = []
+                self.ignore = []
                 self.builder = None
                 self.use_signature = 1
             def children(self):
+                return filter(lambda x, i=self.ignore: x not in i, self.kids)
+            def all_children(self):
                 return self.kids
             def exists(self):
                 return 1
@@ -332,6 +340,10 @@ class CalcTestCase(unittest.TestCase):
 
         assert self.calc.bsig(n1) == 55
 
+        n1.ignore = [n2]
+
+        assert self.calc.bsig(n1) == 33
+
     def test_Calc_bsig(self):
         n = self.nodeclass('n', 11, 12)
 
index d1e546f07d0ed75fbaa6da880aeb1971bd88a1f1..a85019aa91bc3b2eae62e771332a24fecc7b2518 100644 (file)
@@ -199,7 +199,8 @@ class Calculator:
         # for us.  Hence:
         def walk_non_derived(n, myself=node):
             if not n.builder or n is myself:
-                return n.children()
+                return filter(lambda x, i=myself.ignore: x not in i,
+                              n.all_children())
             return []
         walker = SCons.Node.Walker(node, walk_non_derived)
         sigs = []