diff options
author | Steven Knight <knight@baldmt.com> | 2003-01-06 03:54:25 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-01-06 03:54:25 (GMT) |
commit | 6702e9dce5182eaa012da9dc511fcf85cf205049 (patch) | |
tree | 08fd77ca8579ba8426241b560202cd8f9a20c3f8 /src/engine/SCons/Sig | |
parent | 51974ccdc1ee8340c54f8fa02670c554d20ef157 (diff) | |
download | SCons-6702e9dce5182eaa012da9dc511fcf85cf205049.zip SCons-6702e9dce5182eaa012da9dc511fcf85cf205049.tar.gz SCons-6702e9dce5182eaa012da9dc511fcf85cf205049.tar.bz2 |
Performance improvement: cut down on Proxy.__getattr__ calls.
Diffstat (limited to 'src/engine/SCons/Sig')
-rw-r--r-- | src/engine/SCons/Sig/SigTests.py | 13 | ||||
-rw-r--r-- | src/engine/SCons/Sig/__init__.py | 4 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/engine/SCons/Sig/SigTests.py b/src/engine/SCons/Sig/SigTests.py index ccd5897..57c5a51 100644 --- a/src/engine/SCons/Sig/SigTests.py +++ b/src/engine/SCons/Sig/SigTests.py @@ -59,6 +59,9 @@ class DummyNode: self.oldbsig = 0 self.oldcsig = 0 + def has_builder(self): + return self.builder + def get_contents(self): # a file that doesn't exist has no contents: assert self.exists() @@ -97,7 +100,7 @@ class DummyNode: return None def calc_signature(self, calc): - if self.builder: + if self.has_builder(): return calc.bsig(self) else: return calc.csig(self) @@ -212,7 +215,7 @@ class SigTestBase: for node in nodes: self.failUnless(not current(calc, node), - "none of the nodes should be current") + "node %s should not be current" % node.path) # simulate a build: self.files[1].modify('built', 222) @@ -230,7 +233,7 @@ class SigTestBase: for node in nodes: self.failUnless(current(calc, node), - "all of the nodes should be current") + "node %s should be current" % node.path) def test_modify(self): @@ -278,7 +281,7 @@ class SigTestBase: for node in nodes: self.failUnless(current(calc, node), - "all of the nodes should be current") + "node %s should be current" % node.path) class MD5TestCase(unittest.TestCase, SigTestBase): @@ -311,6 +314,8 @@ class CalcTestCase(unittest.TestCase): self.ignore = [] self.builder = None self.use_signature = 1 + def has_builder(self): + return not self.builder is None def children(self): return filter(lambda x, i=self.ignore: x not in i, self.kids) def all_children(self): diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index 5de89fa..4fe9423 100644 --- a/src/engine/SCons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -263,7 +263,7 @@ class Calculator: what's wanted. """ sigs = map(lambda n, c=self: n.calc_signature(c), node.children()) - if node.builder: + if node.has_builder(): sigs.append(self.module.signature(node.builder_sig_adapter())) bsig = self.module.collect(filter(lambda x: not x is None, sigs)) @@ -320,7 +320,7 @@ class Calculator: """ oldtime, oldbsig, oldcsig = node.get_prevsiginfo() - if not node.builder and node.get_timestamp() == oldtime: + if not node.has_builder() and node.get_timestamp() == oldtime: return 1 return self.module.current(newsig, oldbsig) |