comparison piecrust/processing/records.py @ 221:f82262f59600

bake: Fix processing record bugs and error logging for external processes. Fix problems with processing records not being collapsed correctly. Make it possible to capture external processes' `stderr` output.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 03 Feb 2015 08:21:43 -0800
parents c5ada46b281a
children c4b3a7fd2f87
comparison
equal deleted inserted replaced
220:84e2bc2d16cb 221:f82262f59600
31 e.errors = list(new_entry.errors) 31 e.errors = list(new_entry.errors)
32 break 32 break
33 33
34 34
35 FLAG_NONE = 0 35 FLAG_NONE = 0
36 FLAG_PROCESSED = 2**0 36 FLAG_PREPARED = 2**0
37 FLAG_OVERRIDEN = 2**1 37 FLAG_PROCESSED = 2**1
38 FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**2 38 FLAG_OVERRIDEN = 2**2
39 FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**3
39 40
40 41
41 class ProcessorPipelineRecordEntry(object): 42 class ProcessorPipelineRecordEntry(object):
42 def __init__(self, base_dir, rel_input): 43 def __init__(self, base_dir, rel_input):
43 self.base_dir = base_dir 44 self.base_dir = base_dir
51 @property 52 @property
52 def path(self): 53 def path(self):
53 return os.path.join(self.base_dir, self.rel_input) 54 return os.path.join(self.base_dir, self.rel_input)
54 55
55 @property 56 @property
57 def was_prepared(self):
58 return bool(self.flags & FLAG_PREPARED)
59
60 @property
56 def was_processed(self): 61 def was_processed(self):
57 return bool(self.flags & FLAG_PROCESSED) 62 return (self.was_prepared and
63 (bool(self.flags & FLAG_PROCESSED) or len(self.errors) > 0))
58 64
59 @property 65 @property
60 def was_processed_successfully(self): 66 def was_processed_successfully(self):
61 return self.was_processed and not self.errors 67 return self.was_processed and not self.errors
62 68