comparison piecrust/processing/records.py @ 550:6f216c1ab6b1

bake: Add a flag to know which record entries got collapsed from last run. This makes it possible to find entries for things that were actually baked during the current run, as opposed to skipped because they were "clean".
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 04 Aug 2015 21:22:30 -0700
parents c4b3a7fd2f87
children 61d606fbc313
comparison
equal deleted inserted replaced
549:7453baeb0839 550:6f216c1ab6b1
17 17
18 FLAG_NONE = 0 18 FLAG_NONE = 0
19 FLAG_PREPARED = 2**0 19 FLAG_PREPARED = 2**0
20 FLAG_PROCESSED = 2**1 20 FLAG_PROCESSED = 2**1
21 FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**3 21 FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**3
22 FLAG_COLLAPSED_FROM_LAST_RUN = 2**4
22 23
23 24
24 def _get_transition_key(path): 25 def _get_transition_key(path):
25 return hashlib.md5(path.encode('utf8')).hexdigest() 26 return hashlib.md5(path.encode('utf8')).hexdigest()
26 27
44 (bool(self.flags & FLAG_PROCESSED) or len(self.errors) > 0)) 45 (bool(self.flags & FLAG_PROCESSED) or len(self.errors) > 0))
45 46
46 @property 47 @property
47 def was_processed_successfully(self): 48 def was_processed_successfully(self):
48 return self.was_processed and not self.errors 49 return self.was_processed and not self.errors
50
51 @property
52 def was_collapsed_from_last_run(self):
53 return self.flags & FLAG_COLLAPSED_FROM_LAST_RUN
49 54
50 55
51 class TransitionalProcessorPipelineRecord(TransitionalRecord): 56 class TransitionalProcessorPipelineRecord(TransitionalRecord):
52 def __init__(self, previous_path=None): 57 def __init__(self, previous_path=None):
53 super(TransitionalProcessorPipelineRecord, self).__init__( 58 super(TransitionalProcessorPipelineRecord, self).__init__(
73 def collapseRecords(self): 78 def collapseRecords(self):
74 for prev, cur in self.transitions.values(): 79 for prev, cur in self.transitions.values():
75 if prev and cur and not cur.was_processed: 80 if prev and cur and not cur.was_processed:
76 # This asset wasn't processed, so the information from 81 # This asset wasn't processed, so the information from
77 # last time is still valid. 82 # last time is still valid.
78 cur.flags = prev.flags 83 cur.flags = prev.flags | FLAG_COLLAPSED_FROM_LAST_RUN
79 cur.rel_outputs = list(prev.rel_outputs) 84 cur.rel_outputs = list(prev.rel_outputs)
80 cur.errors = list(prev.errors) 85 cur.errors = list(prev.errors)
81 86
82 def getDeletions(self): 87 def getDeletions(self):
83 for prev, cur in self.transitions.values(): 88 for prev, cur in self.transitions.values():