diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-06-11 18:16:56 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-06-11 18:16:56 +0100 |
commit | a64dabe821a39bce653e2b12922922fa43d7f4ea (patch) | |
tree | 5b7927e9d2410719f58975d174eb769dec35908b /morphlib | |
parent | 4411f087e0d5c754405e0f57eb4f6918404cae36 (diff) | |
download | morph-a64dabe821a39bce653e2b12922922fa43d7f4ea.tar.gz |
Refactor building a group to list of artifacts
Move the decision making for checking what in the group needs
building outside of the method, for greater cohesion.
Diffstat (limited to 'morphlib')
-rwxr-xr-x | morphlib/app.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/morphlib/app.py b/morphlib/app.py index db28d1ce..82f20ce7 100755 --- a/morphlib/app.py +++ b/morphlib/app.py @@ -268,13 +268,10 @@ class Morph(cliapp.Application): handle = lac.get(chunk_artifact) staging_area.install_artifact(handle) - def build_group(self, group, needed, builder, lac, staging_area): - for artifact in group: - if artifact in needed: - self.msg('Building %s' % artifact.name) - builder.build_and_cache(artifact) - else: - self.msg('Using cached %s' % artifact.name) + def build_group(self, artifacts, builder, lac, staging_area): + for artifact in artifacts: + self.msg('Building %s' % artifact.name) + builder.build_and_cache(artifact) def cmd_build(self, args): '''Build a binary from a morphology. @@ -331,7 +328,10 @@ class Morph(cliapp.Application): if install_chunks: self.install_artifacts(staging_area, lac, to_install) del to_install[:] - self.build_group(group, needed, builder, lac, staging_area) + for artfact in set(group).difference(set(needed)): + self.msg('Using cached %s' % artifact.name) + wanted = [x for x in group if x in needed] + self.build_group(wanted, builder, lac, staging_area) to_install.extend( x for x in group if x.source.morphology['kind'] == 'chunk') |