comparison piecrust/commands/builtin/util.py @ 666:81d9c3a3a0b5

internal: Get rid of the whole "sub cache" business. * Compute cache keys up front, so the cache directory is only chosen once. * Buffer up config variants to apply before loading the config. Makes it possible to cache variant-resulting configs, too. * Make a factory class to reuse the logic that creates the `PieCrust` object correctly for multi-process workers and such. * Add a test.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 03 Mar 2016 08:22:41 -0800
parents 3ceeca7bb71c
children 6e92b5cd0163
comparison
equal deleted inserted replaced
665:5dc13c816045 666:81d9c3a3a0b5
61 61
62 def setupParser(self, parser, app): 62 def setupParser(self, parser, app):
63 pass 63 pass
64 64
65 def run(self, ctx): 65 def run(self, ctx):
66 cache_dir = ctx.app.sub_cache_dir 66 cache_dir = ctx.app.cache_dir
67 if cache_dir and os.path.isdir(cache_dir): 67 if cache_dir and os.path.isdir(cache_dir):
68 logger.info("Purging cache: %s" % cache_dir) 68 logger.info("Purging cache: %s" % cache_dir)
69 shutil.rmtree(cache_dir) 69 shutil.rmtree(cache_dir)
70 70
71 71