Mercurial > piecrust2
comparison piecrust/commands/builtin/baking.py @ 879:58ae026b4c31
chef: Optimize startup time.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 15 Jun 2017 22:38:05 -0700 |
parents | 93ea115027fc |
children | 803c5c28a71f |
comparison
equal
deleted
inserted
replaced
878:313db67cfc35 | 879:58ae026b4c31 |
---|---|
1 import os.path | 1 import os.path |
2 import time | 2 import time |
3 import pprint | |
4 import logging | 3 import logging |
5 import fnmatch | |
6 import textwrap | |
7 import datetime | 4 import datetime |
8 from colorama import Fore | 5 from colorama import Fore |
9 from piecrust.commands.base import ChefCommand | 6 from piecrust.commands.base import ChefCommand |
10 | 7 |
11 | 8 |
164 parser.add_argument( | 161 parser.add_argument( |
165 '--show-manifest', | 162 '--show-manifest', |
166 help="Show manifest entries from the record.") | 163 help="Show manifest entries from the record.") |
167 | 164 |
168 def run(self, ctx): | 165 def run(self, ctx): |
166 import fnmatch | |
169 from piecrust.baking.baker import get_bake_records_path | 167 from piecrust.baking.baker import get_bake_records_path |
170 from piecrust.pipelines.records import load_records | 168 from piecrust.pipelines.records import load_records |
171 | 169 |
172 out_dir = ctx.args.output or os.path.join(ctx.app.root_dir, '_counter') | 170 out_dir = ctx.args.output or os.path.join(ctx.app.root_dir, '_counter') |
173 suffix = '' if ctx.args.last == 0 else '.%d' % ctx.args.last | 171 suffix = '' if ctx.args.last == 0 else '.%d' % ctx.args.last |
279 for v in val: | 277 for v in val: |
280 logger.info("%s - %s" % (indent, v)) | 278 logger.info("%s - %s" % (indent, v)) |
281 | 279 |
282 | 280 |
283 def _print_record_entry(e): | 281 def _print_record_entry(e): |
282 import pprint | |
283 import textwrap | |
284 | |
284 logger.info(" - %s" % e.item_spec) | 285 logger.info(" - %s" % e.item_spec) |
285 logger.info(" Outputs:") | 286 logger.info(" Outputs:") |
286 out_paths = list(e.getAllOutputPaths()) | 287 out_paths = list(e.getAllOutputPaths()) |
287 if out_paths: | 288 if out_paths: |
288 for op in out_paths: | 289 for op in out_paths: |