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"""
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])
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
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
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
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
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()