diff options
author | Steven Knight <knight@baldmt.com> | 2004-04-17 12:34:55 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-04-17 12:34:55 (GMT) |
commit | 6afc74928b529087a998c8cb036f471f0a2497c9 (patch) | |
tree | e89b0387d2448f33c7a1dcf1cc47d12f584787fa /src/engine/SCons/Sig | |
parent | cf66aef7008b81abfb4e126e99cef44a29dbda10 (diff) | |
download | SCons-6afc74928b529087a998c8cb036f471f0a2497c9.zip SCons-6afc74928b529087a998c8cb036f471f0a2497c9.tar.gz SCons-6afc74928b529087a998c8cb036f471f0a2497c9.tar.bz2 |
Add the highly anticipated --debug=explain option to provide build reasoning.
Diffstat (limited to 'src/engine/SCons/Sig')
-rw-r--r-- | src/engine/SCons/Sig/SigTests.py | 32 | ||||
-rw-r--r-- | src/engine/SCons/Sig/__init__.py | 37 |
2 files changed, 46 insertions, 23 deletions
diff --git a/src/engine/SCons/Sig/SigTests.py b/src/engine/SCons/Sig/SigTests.py index f297464..98465ff 100644 --- a/src/engine/SCons/Sig/SigTests.py +++ b/src/engine/SCons/Sig/SigTests.py @@ -106,8 +106,12 @@ class DummyNode: else: return calc.csig(self) - def set_bsig(self, bsig): + def set_binfo(self, bsig, bkids, bkidsigs, bact, bactsig): self.bsig = bsig + self.bkids = bkids + self.bkidsigs = bkidsigs + self.bact = bact + self.bactsig = bactsig def get_bsig(self): return self.bsig @@ -129,12 +133,6 @@ class DummyNode: def get_stored_implicit(self): return None - - def store_csig(self): - pass - - def store_bsig(self): - pass def store_timestamp(self): pass @@ -327,8 +325,12 @@ class CalcTestCase(unittest.TestCase): return 1 def get_bsig(self): return self.bsig - def set_bsig(self, bsig): + def set_binfo(self, bsig, bkids, bkidsig, bact, bactsig): self.bsig = bsig + self.bkids = bkids + self.bkidsigs = bkidsigs + self.bact = bact + self.bactsig = bactsig def get_csig(self): return self.csig def set_csig(self, csig): @@ -414,7 +416,7 @@ class _SConsignTestCase(unittest.TestCase): path = 'not_a_valid_path' f = SCons.Sig._SConsign() - f.set_bsig('foo', 1) + f.set_binfo('foo', 1, ['f1'], ['f2'], 'foo act', 'foo actsig') assert f.get('foo') == (None, 1, None) f.set_csig('foo', 2) assert f.get('foo') == (None, 1, 2) @@ -425,7 +427,7 @@ class _SConsignTestCase(unittest.TestCase): assert f.get_implicit('foo') == ['bar'] f = SCons.Sig._SConsign(DummyModule()) - f.set_bsig('foo', 1) + f.set_binfo('foo', 1, ['f1'], ['f2'], 'foo act', 'foo actsig') assert f.get('foo') == (None, 1, None) f.set_csig('foo', 2) assert f.get('foo') == (None, 1, 2) @@ -446,20 +448,20 @@ class SConsignDBTestCase(unittest.TestCase): try: d1 = SCons.Sig.SConsignDB(DummyNode('dir1')) d1.set_timestamp('foo', 1) - d1.set_bsig('foo', 2) + d1.set_binfo('foo', 2, ['f1'], ['f2'], 'foo act', 'foo actsig') d1.set_csig('foo', 3) d1.set_timestamp('bar', 4) - d1.set_bsig('bar', 5) + d1.set_binfo('bar', 5, ['b1'], ['b2'], 'bar act', 'bar actsig') d1.set_csig('bar', 6) assert d1.get('foo') == (1, 2, 3) assert d1.get('bar') == (4, 5, 6) d2 = SCons.Sig.SConsignDB(DummyNode('dir1')) d2.set_timestamp('foo', 7) - d2.set_bsig('foo', 8) + d2.set_binfo('foo', 8, ['f3'], ['f4'], 'foo act', 'foo actsig') d2.set_csig('foo', 9) d2.set_timestamp('bar', 10) - d2.set_bsig('bar', 11) + d2.set_binfo('bar', 11, ['b3'], ['b4'], 'bar act', 'bar actsig') d2.set_csig('bar', 12) assert d2.get('foo') == (7, 8, 9) assert d2.get('bar') == (10, 11, 12) @@ -480,7 +482,7 @@ class SConsignDirFileTestCase(unittest.TestCase): path = 'not_a_valid_path' f = SCons.Sig.SConsignDirFile(DummyNode(), DummyModule()) - f.set_bsig('foo', 1) + f.set_binfo('foo', 1, ['f1'], ['f2'], 'foo act', 'foo actsig') assert f.get('foo') == (None, 1, None) f.set_csig('foo', 2) assert f.get('foo') == (None, 1, 2) diff --git a/src/engine/SCons/Sig/__init__.py b/src/engine/SCons/Sig/__init__.py index a2ebd5c..d703194 100644 --- a/src/engine/SCons/Sig/__init__.py +++ b/src/engine/SCons/Sig/__init__.py @@ -73,6 +73,10 @@ class SConsignEntry: bsig = None csig = None implicit = None + bkids = [] + bkidsigs = [] + bact = None + bactsig = None class _SConsign: """ @@ -139,9 +143,9 @@ class _SConsign: entry.csig = csig self.set_entry(filename, entry) - def set_bsig(self, filename, bsig): + def set_binfo(self, filename, bsig, bkids, bkidsigs, bact, bactsig): """ - Set the csig .sconsign entry for a file + Set the build info .sconsign entry for a file filename - the filename whose signature will be set bsig - the file's built signature @@ -149,11 +153,15 @@ class _SConsign: entry = self.get_entry(filename) entry.bsig = bsig + entry.bkids = bkids + entry.bkidsigs = bkidsigs + entry.bact = bact + entry.bactsig = bactsig self.set_entry(filename, entry) def set_timestamp(self, filename, timestamp): """ - Set the csig .sconsign entry for a file + Set the timestamp .sconsign entry for a file filename - the filename whose signature will be set timestamp - the file's timestamp @@ -171,12 +179,17 @@ class _SConsign: def set_implicit(self, filename, implicit): """Cache the implicit dependencies for 'filename'.""" entry = self.get_entry(filename) - if SCons.Util.is_String(implicit): + if not SCons.Util.is_List(implicit): implicit = [implicit] implicit = map(str, implicit) entry.implicit = implicit self.set_entry(filename, entry) + def get_binfo(self, filename): + """Fetch the cached implicit dependencies for 'filename'""" + entry = self.get_entry(filename) + return entry.bsig, entry.bkids, entry.bkidsigs, entry.bact, entry.bactsig + class SConsignDB(_SConsign): """ A _SConsign subclass that reads and writes signature information @@ -360,20 +373,28 @@ class Calculator: return bsig children = node.children() + bkids = map(str, children) - # double check bsig, because the call to childre() above may + # double check bsig, because the call to children() above may # have set it: bsig = cache.get_bsig() if bsig is not None: return bsig sigs = map(lambda n, c=self: n.calc_signature(c), children) + if node.has_builder(): - sigs.append(self.module.signature(node.get_executor())) + executor = node.get_executor() + bact = str(executor) + bactsig = self.module.signature(executor) + sigs.append(bactsig) + else: + bact = "" + bactsig = "" - bsig = self.module.collect(filter(lambda x: not x is None, sigs)) + bsig = self.module.collect(filter(None, sigs)) - cache.set_bsig(bsig) + cache.set_binfo(bsig, bkids, sigs, bact, bactsig) # don't store the bsig here, because it isn't accurate until # the node is actually built. |