Mercurial > piecrust2
view piecrust/pipelines/_procrecords.py @ 979:45ad976712ec
tests: Big push to get the tests to pass again.
- Lots of fixes everywhere in the code.
- Try to handle debug logging in the multiprocessing worker pool when running in pytest. Not perfect, but usable for now.
- Replace all `.md` test files with `.html` since now a auto-format extension always sets the format.
- Replace `out` with `outfiles` in most places since now blog archives are added to the bake output and I don't want to add expected outputs for blog archives everywhere.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 Oct 2017 22:51:57 -0700 |
parents | 448710d84121 |
children | 8adc27285d93 |
line wrap: on
line source
from piecrust.pipelines.records import ( RecordEntry, get_flag_descriptions) class AssetPipelineRecordEntry(RecordEntry): FLAG_NONE = 0 FLAG_PREPARED = 2**0 FLAG_PROCESSED = 2**1 FLAG_BYPASSED_STRUCTURED_PROCESSING = 2**3 FLAG_COLLAPSED_FROM_LAST_RUN = 2**4 def __init__(self): super().__init__() self.flags = self.FLAG_NONE self.proc_tree = None self.out_paths = [] @property def was_prepared(self): return bool(self.flags & self.FLAG_PREPARED) @property def was_processed(self): return (self.was_prepared and (bool(self.flags & self.FLAG_PROCESSED) or len(self.errors) > 0)) @property def was_processed_successfully(self): return self.was_processed and not self.errors @property def was_collapsed_from_last_run(self): return self.flags & self.FLAG_COLLAPSED_FROM_LAST_RUN def describe(self): d = super().describe() d['Flags'] = get_flag_descriptions(self.flags, flag_descriptions) d['Processing Tree'] = _format_proc_tree(self.proc_tree, 20 * ' ') return d def getAllOutputPaths(self): return self.out_paths flag_descriptions = { AssetPipelineRecordEntry.FLAG_PREPARED: 'prepared', AssetPipelineRecordEntry.FLAG_PROCESSED: 'processed', AssetPipelineRecordEntry.FLAG_BYPASSED_STRUCTURED_PROCESSING: 'external', AssetPipelineRecordEntry.FLAG_COLLAPSED_FROM_LAST_RUN: 'from last run'} def _format_proc_tree(tree, margin='', level=0): name, children = tree res = '%s%s+ %s\n' % (margin if level > 0 else '', level * ' ', name) if children: for c in children: res += _format_proc_tree(c, margin, level + 1) return res