summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:59:29 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-06-11 17:59:29 +0100
commit361454c0762324ddbd4097ac9099921edcebb428 (patch)
tree7ef3fdc6da37688f7eca8692bd934951d0f361ba /morphlib
parent0384837b7eea5d7532abbaca62647f069ddbec8f (diff)
downloadmorph-361454c0762324ddbd4097ac9099921edcebb428.tar.gz
Refactor building a group into its own method
Diffstat (limited to 'morphlib')
-rwxr-xr-xmorphlib/app.py25
1 files changed, 14 insertions, 11 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 482fdd5d..61fd0b22 100755
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -268,6 +268,18 @@ class Morph(cliapp.Application):
handle = lac.get(chunk_artifact)
staging_area.install_artifact(handle)
+ def build_group(self, group, needed, install_chunks, to_install, builder,
+ lac, staging_area):
+ for artifact in group:
+ if artifact in needed:
+ self.msg('Building %s' % artifact.name)
+ if install_chunks:
+ self.install_artifacts(staging_area, lac, to_install)
+ del to_install[:]
+ builder.build_and_cache(artifact)
+ else:
+ self.msg('Using cached %s' % artifact.name)
+
def cmd_build(self, args):
'''Build a binary from a morphology.
@@ -322,17 +334,8 @@ class Morph(cliapp.Application):
to_install = []
for group in order.groups:
- for artifact in group:
- if artifact in needed:
- self.msg('Building %s' % artifact.name)
- if install_chunks:
- self.install_artifacts(staging_area, lac,
- to_install)
- to_install = []
- builder.build_and_cache(artifact)
- else:
- self.msg('Using cached %s' % artifact.name)
-
+ self.build_group(group, needed, install_chunks, to_install,
+ builder, lac, staging_area)
to_install.extend(
x for x in group
if x.source.morphology['kind'] == 'chunk')