summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/Node/FSTests.py3
-rw-r--r--src/engine/SCons/Node/NodeTests.py6
-rw-r--r--src/engine/SCons/Node/__init__.py31
3 files changed, 27 insertions, 13 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index fe9ea61..0e19cec 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -388,6 +388,9 @@ class FSTestCase(unittest.TestCase):
assert f1.implicit[0].path_ == os.path.join("d1", "f1")
f1.implicit = []
f1.scan()
+ assert f1.implicit == []
+ f1.implicit = None
+ f1.scan()
assert f1.implicit[0].path_ == os.path.join("d1", "f1")
# Test building a file whose directory is not there yet...
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index ef98a41..4caebb5 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -386,7 +386,9 @@ class NodeTestCase(unittest.TestCase):
node = SCons.Node.Node()
assert node.target_scanner == None, node.target_scanner
node.target_scanner = ds
+ assert node.implicit is None
node.scan()
+ assert node.implicit == []
def test_scanner_key(self):
"""Test that a scanner_key() method exists"""
@@ -411,6 +413,7 @@ class NodeTestCase(unittest.TestCase):
node.add_source([n1, n2, n3])
node.add_dependency([n4, n5, n6])
+ node.implicit = []
node._add_child(node.implicit, [n7, n8, n9])
node._add_child(node.implicit, [n10, n11, n12])
node.add_ignore([n2, n5, n8, n11])
@@ -440,13 +443,14 @@ class NodeTestCase(unittest.TestCase):
node.add_source([n1, n2, n3])
node.add_dependency([n4, n5, n6])
+ node.implicit = []
node._add_child(node.implicit, [n7, n8, n9])
node._add_child(node.implicit, [n10, n11, n12])
node.add_ignore([n2, n5, n8, n11])
kids = node.all_children()
for kid in [n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12]:
- assert kid in kids
+ assert kid in kids, kid
def test_state(self):
"""Test setting and getting the state of a node
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index db11e55..67ad743 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -61,7 +61,7 @@ class Node:
def __init__(self):
self.sources = [] # source files used to build node
self.depends = [] # explicit dependencies (from Depends)
- self.implicit = [] # implicit (scanned) dependencies
+ self.implicit = None # implicit (scanned) dependencies (None means not scanned yet)
self.ignore = [] # dependencies to ignore
self.parents = {}
self.wkids = None # Kids yet to walk, when it's an array
@@ -119,7 +119,7 @@ class Node:
def get_parents(node, parent): return node.get_parents()
def clear_cache(node, parent):
- node.implicit = []
+ node.implicit = None
w = Walker(self, get_parents, ignore_cycle, clear_cache)
while w.next(): pass
@@ -163,15 +163,19 @@ class Node:
def scan(self):
"""Scan this node's dependents for implicit dependencies."""
# Don't bother scanning non-derived files, because we don't
- # care what their dependencies are.
+ # care what their dependencies are.
# Don't scan again, if we already have scanned.
- if self.builder and not self.implicit:
- for child in self.children(scan=0):
- self._add_child(self.implicit, child.get_implicit_deps(self.env, child.source_scanner, self))
+ if self.implicit is None:
+ if self.builder:
+ self.implicit = []
+ for child in self.children(scan=0):
+ self._add_child(self.implicit, child.get_implicit_deps(self.env, child.source_scanner, self))
- # scan this node itself for implicit dependencies
- self._add_child(self.implicit, self.get_implicit_deps(self.env, self.target_scanner, self))
-
+ # scan this node itself for implicit dependencies
+ self._add_child(self.implicit, self.get_implicit_deps(self.env, self.target_scanner, self))
+ else:
+ self.implicit = []
+
def scanner_key(self):
return None
@@ -248,10 +252,13 @@ class Node:
def all_children(self, scan=1):
"""Return a list of all the node's direct children."""
#XXX Need to remove duplicates from this
- if scan and not self.implicit:
+ if scan:
self.scan()
- return self.sources + self.depends + self.implicit
-
+ if self.implicit is None:
+ return self.sources + self.depends
+ else:
+ return self.sources + self.depends + self.implicit
+
def get_parents(self):
return self.parents.keys()