From 6b8764541602365b9088cd8ba002318e7020dd01 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Wed, 2 Jun 2004 05:34:57 +0000 Subject: [PATCH] Make the use of the calc argument in Node methods consistent. git-svn-id: http://scons.tigris.org/svn/scons/trunk@991 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/engine/SCons/Node/FS.py | 10 ++++++---- src/engine/SCons/Node/Python.py | 2 +- src/engine/SCons/Node/__init__.py | 15 ++++++++++----- src/engine/SCons/Taskmaster.py | 2 +- src/engine/SCons/TaskmasterTests.py | 9 +++++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 50b725b0..23cf8a7a 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -635,7 +635,7 @@ class Entry(Base): self.clear() return File.exists(self) - def calc_signature(self, calc): + def calc_signature(self, calc=None): """Return the Entry's calculated signature. Check the file system to see what we should turn into first. Assume a file if there's no directory.""" @@ -1259,7 +1259,7 @@ class Dir(Base): def prepare(self): pass - def current(self, calc): + def current(self, calc=None): """If all of our children were up-to-date, then this directory was up-to-date, too.""" state = 0 @@ -1633,7 +1633,7 @@ class File(Base): except AttributeError: pass - def calc_csig(self, calc): + def calc_csig(self, calc=None): """ Generate a node's content signature, the digested signature of its content. @@ -1642,6 +1642,8 @@ class File(Base): cache - alternate node to use for the signature cache returns - the content signature """ + if calc is None: + calc = self.calculator() try: return self.binfo.csig @@ -1675,7 +1677,7 @@ class File(Base): return csig - def current(self, calc): + def current(self, calc=None): self.binfo = self.gen_binfo(calc) if self.always_build: return None diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py index e15888b2..28ff6749 100644 --- a/src/engine/SCons/Node/Python.py +++ b/src/engine/SCons/Node/Python.py @@ -62,7 +62,7 @@ class Value(SCons.Node.Node): contents = contents + kid.get_contents() return contents - def calc_csig(self, calc): + def calc_csig(self, calc=None): """Because we're a Python value node and don't have a real timestamp, we get to ignore the calculator and just use the value contents.""" diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 65cb6832..ba4cbca5 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -464,7 +464,7 @@ class Node: env = self.env or SCons.Defaults.DefaultEnvironment() return env.get_calculator() - def calc_signature(self, calc): + def calc_signature(self, calc=None): """ Select and calculate the appropriate build signature for a node. @@ -500,14 +500,14 @@ class Node: except AttributeError: pass - def calc_bsig(self, calc): + def calc_bsig(self, calc=None): try: return self.binfo.bsig except AttributeError: self.binfo = self.gen_binfo(calc) return self.binfo.bsig - def gen_binfo(self, calc): + def gen_binfo(self, calc=None): """ Generate a node's build signature, the digested signatures of its dependency files and build information. @@ -522,6 +522,9 @@ class Node: what's wanted. """ + if calc is None: + calc = self.calculator() + binfo = self.new_binfo() self.scan() @@ -565,7 +568,7 @@ class Node: except AttributeError: pass - def calc_csig(self, calc): + def calc_csig(self, calc=None): try: binfo = self.binfo except AttributeError: @@ -573,6 +576,8 @@ class Node: try: return binfo.csig except AttributeError: + if calc is None: + calc = self.calculator() binfo.csig = calc.module.signature(self) self.store_info(binfo) return binfo.csig @@ -747,7 +752,7 @@ class Node: subtypes are always out of date, so they will always get built.""" return None - def children_are_up_to_date(self, calc): + def children_are_up_to_date(self, calc=None): """Alternate check for whether the Node is current: If all of our children were up-to-date, then this Node was up-to-date, too. diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index b09a5892..7fb94aa9 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -192,7 +192,7 @@ class Task: """ self.out_of_date = [] for t in self.targets: - if not t.current(t.calculator()): + if not t.current(): self.out_of_date.append(t) if self.out_of_date: self.mark_targets_and_side_effects(SCons.Node.executing) diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 5955ecfd..ebf0e9cb 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -45,7 +45,10 @@ class Node: self.cached = 0 self.scanned = 0 self.scanner = None - self.builder = Node.build + class Builder: + def targets(self, node): + return [node] + self.builder = Builder() self.bsig = None self.csig = None self.state = None @@ -137,7 +140,9 @@ class Node: return node._current_val return Calc() - def current(self, calc): + def current(self, calc=None): + if calc is None: + calc = self.calculator() return calc.current(self, calc.bsig(self)) def depends_on(self, nodes): -- 2.26.2