else:
self.abspath = self.path = name
self.parent = directory
- self.uses_signature = 1
+ self.use_signature = 1
def __str__(self):
"""A FS node's string representation is its path name."""
def exists(self):
return os.path.exists(self.path)
-
+ def current(self):
+ """If the underlying path doesn't exist, we know the node is
+ not current without even checking the signature, so return 0.
+ Otherwise, return None to indicate that signature calculation
+ should proceed as normal to find out if the node is current."""
+ if not self.exists():
+ return 0
+ return None
+
+
# XXX TODO?
# Annotate with the creator
delattr(self, 'parent')
else:
self.entries['..'] = None
- self.uses_signature = None
+ self.use_signature = None
def up(self):
return self.entries['..']
filter(lambda k: k != '.' and k != '..',
self.entries.keys()))
+ def current(self):
+ """Always return that a directory node is out-of-date so
+ that it will always be "built" by trying to build all of
+ its directory entries."""
+ return 0
+
# XXX TODO?
# rfile
f1 = fs.File('f1', directory = d1)
+ assert d1.current() == 0
+ assert f1.current() == 0
+
assert f1.path == 'd1/f1', "f1.path %s != d1/f1" % f1.path
assert str(f1) == 'd1/f1', "str(f1) %s != d1/f1" % str(f1)
node.builder_set(b)
assert node.builder == b
+ def test_current(self):
+ node = SCons.Node.Node()
+ assert node.current() is None
+
def test_env_set(self):
"""Test setting a Node's Environment
"""
self.builder = None
self.env = None
self.state = None
+ self.use_signature = 1
def build(self):
if not self.builder:
def get_state(self):
return self.state
+ def current(self):
+ return None
+
class Wrapper:
def __init__(self, node):
self.node = node
self.path = file.path
self.builder = file.builder
self.depends = []
+ self.use_signature = 1
def get_contents(self):
# a file that doesn't exist has no contents:
def exists(self):
return not self.file.contents is None
-
+
+ def children(self):
+ return self.sources + self.depends
+
+ def current(self):
+ if not self.exists():
+ return 0
+ return None
+
def has_signature(self):
return hasattr(self, "sig")
signatures - the dictionary that the signatures will be
gathered into.
"""
- for source_node in node.sources + node.depends:
+ for source_node in node.children():
if not signatures.has_key(source_node):
signature = self.signature(source_node)
signatures[source_node] = signature
in the .sconsign file.
"""
- if node.has_signature():
+ if not node.use_signature:
+ # This node type doesn't use a signature (e.g. a
+ # directory) so bail right away.
+ return None
+ elif node.has_signature():
sig = node.get_signature()
elif node.builder:
signatures = {}
and 1 if it hasn't
"""
- if not node.exists():
- return 0
+ c = node.current()
+ if not c is None:
+ # The node itself has told us whether or not it's
+ # current without checking the signature. The
+ # canonical uses here are a "0" return for a file
+ # that doesn't exist, or a directory.
+ return c
dir, filename = os.path.split(node.path)
oldtime, oldsig = self.get_sig_file(dir).get(filename)