# HG changeset patch # User Ludovic Chabant # Date 1408687771 25200 # Node ID efd0d3bacc9e56c7a1ca8eba37567f9818ad079e # Parent a62452ab5080c51e1153b2eb0f4296bb3a347a56 Don't recursively clean the cache. diff -r a62452ab5080 -r efd0d3bacc9e piecrust/baking/baker.py --- a/piecrust/baking/baker.py Thu Aug 21 22:52:18 2014 -0700 +++ b/piecrust/baking/baker.py Thu Aug 21 23:09:31 2014 -0700 @@ -254,7 +254,7 @@ # Load/create the bake record. record = TransitionalBakeRecord() - record_cache = self.app.cache.getCache('bake_r') + record_cache = self.app.cache.getCache('baker') record_name = (hashlib.md5(self.out_dir.encode('utf8')).hexdigest() + '.record') if not self.force and record_cache.has(record_name): @@ -328,11 +328,11 @@ reason = "templates modified" if reason is not None: - cache_dir = self.app.cache_dir + cache_dir = self.app.cache.getCacheDir('baker') if os.path.isdir(cache_dir): - logger.debug("Cleaning cache: %s" % cache_dir) + logger.debug("Cleaning baker cache: %s" % cache_dir) shutil.rmtree(cache_dir) - self.force = True + self.force = True logger.info(format_timed(start_time, "cleaned cache (reason: %s)" % reason)) else: diff -r a62452ab5080 -r efd0d3bacc9e piecrust/cache.py --- a/piecrust/cache.py Thu Aug 21 22:52:18 2014 -0700 +++ b/piecrust/cache.py Thu Aug 21 23:09:31 2014 -0700 @@ -32,6 +32,9 @@ self.caches[name] = c return c + def getCacheDir(self, name): + return os.path.join(self.base_dir, name) + class SimpleCache(object): def __init__(self, base_dir): @@ -72,6 +75,7 @@ cache_dir = os.path.dirname(cache_path) if not os.path.isdir(cache_dir): os.makedirs(cache_dir, 0o755) + logger.debug("Writing cache: %s" % cache_path) with codecs.open(cache_path, 'w', 'utf-8') as fp: fp.write(content) diff -r a62452ab5080 -r efd0d3bacc9e piecrust/commands/builtin/baking.py --- a/piecrust/commands/builtin/baking.py Thu Aug 21 22:52:18 2014 -0700 +++ b/piecrust/commands/builtin/baking.py Thu Aug 21 23:09:31 2014 -0700 @@ -66,7 +66,7 @@ def run(self, ctx): out_dir = ctx.args.output or os.path.join(ctx.app.root_dir, '_counter') - record_cache = ctx.app.cache.getCache('bake_r') + record_cache = ctx.app.cache.getCache('baker') record_name = hashlib.md5(out_dir.encode('utf8')).hexdigest() + '.record' if not record_cache.has(record_name): raise Exception("No record has been created for this output path. "