diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2014-01-07 16:01:19 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2014-01-10 11:49:56 +0000 |
commit | 369776bd1b32a35c85730b06e16235aa3e8b004b (patch) | |
tree | 9a15ff1aea493c9313e640411976caf8b2431c00 | |
parent | a49bae2710fcacd0301d45966c641b9bbe77810f (diff) | |
download | morph-369776bd1b32a35c85730b06e16235aa3e8b004b.tar.gz |
BuildCommand.find_root_artifact: Simplify root artifact location algorithm
It's way simpler to pick things that have no dependents than go through
all the artifacts and remove any that are depended on.
-rw-r--r-- | morphlib/buildcommand.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/morphlib/buildcommand.py b/morphlib/buildcommand.py index 882c8d9e..d7d43af4 100644 --- a/morphlib/buildcommand.py +++ b/morphlib/buildcommand.py @@ -254,11 +254,10 @@ class BuildCommand(object): ''' - maybe = set(artifacts) + maybe = set() for a in artifacts: - for dep in a.dependencies: - if dep in maybe: - maybe.remove(dep) + if not a.dependents: + maybe.add(a) if len(maybe) != 1: raise MultipleRootArtifactsError(maybe) return maybe.pop() |