diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-27 17:52:43 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-03-27 17:52:43 +0100 |
commit | a0039e241f899f3c562a737f1bc17b305b46c422 (patch) | |
tree | 0103aa986fb83dbd5cfac2fba52b704b9ea19cbc | |
parent | 05575c35b2f2ce4faa8c9df2389bdccdaf5aed9f (diff) | |
download | morph-a0039e241f899f3c562a737f1bc17b305b46c422.tar.gz |
Refactor: remove unnecessary method
I found the write_cache_metadata and prepare_binary_metadata methods
be confusingly similar, when skimming code. Since write_cache_metadata
was very short and only used from one place, inlined it, which removes
the confusion without, I think, adding complexity.
-rw-r--r-- | morphlib/builder.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/morphlib/builder.py b/morphlib/builder.py index cbf4b299..fa0943a4 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -203,12 +203,6 @@ class BlobBuilder(object): # pragma: no cover json.dump(meta, f, indent=4) f.write('\n') - def write_cache_metadata(self, meta): - self.msg('Writing metadata to the cache') - with self.cachedir.open(self.cache_key, suffix='.meta') as f: - json.dump(meta, f, indent=4) - f.write('\n') - def save_build_times(self): meta = { 'build-times': {} @@ -219,7 +213,11 @@ class BlobBuilder(object): # pragma: no cover 'stop': '%s' % self.build_watch.stop_time(stage), 'delta': '%.4f' % self.build_watch.start_stop_seconds(stage) } - self.write_cache_metadata(meta) + + self.msg('Writing metadata to the cache') + with self.cachedir.open(self.cache_key, suffix='.meta') as f: + json.dump(meta, f, indent=4) + f.write('\n') def prepare_logfile(self): self.logfile = self.cachedir.open(self.cache_key, suffix='.log', |