From 8c9369d86d0168e9509ec06d7bb5f4f9b5e82311 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Thu, 1 Mar 2012 14:39:27 +0000 Subject: Simplify how BlobBuilder.builds gets implemented/inherited It needs to be different for each subclass, yet SystemBuilder was sharing the implementation with ChunkBuilder, which worked, but only by happenstance. Now each class has their own implementation and the base class has a NotImplemented implementation. --- morphlib/builder.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'morphlib/builder.py') diff --git a/morphlib/builder.py b/morphlib/builder.py index a158a3ea..ed7b4378 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -171,10 +171,7 @@ class BlobBuilder(object): # pragma: no cover self.logfile.write('%s\n' % text) def builds(self): - ret = {} - for chunk_name in self.blob.chunks: - ret[chunk_name] = self.filename(chunk_name) - return ret + raise NotImplemented() def build(self): self.prepare_logfile() @@ -275,6 +272,12 @@ class ChunkBuilder(BlobBuilder): # pragma: no cover }, } + def builds(self): + ret = {} + for chunk_name in self.blob.chunks: + ret[chunk_name] = self.filename(chunk_name) + return ret + def do_build(self): self.msg('Creating build tree at %s' % self.builddir) @@ -495,6 +498,9 @@ class StratumBuilder(BlobBuilder): # pragma: no cover class SystemBuilder(BlobBuilder): # pragma: no cover + def builds(self): + return {} + def do_build(self): self.ex = morphlib.execute.Execute(self.tempdir.dirname, self.msg) -- cgit v1.2.1