diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-31 16:38:18 +0000 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-01-31 16:42:41 +0000 |
commit | c2104eb199916f9ef7e7b77d0eebf33619ed3ea9 (patch) | |
tree | 01eb904eda1461bf70ecf97aa8f6445d0bbfbb07 /morphlib/blobs.py | |
parent | ab965be42d10f2608dc883ee0cc34a1cd0fe5058 (diff) | |
download | morph-c2104eb199916f9ef7e7b77d0eebf33619ed3ea9.tar.gz |
Properly unpack dependencies into the staging area in build-single.
This requires build-single to take a dependency context tuple when
building chunks of a stratum. This context tuple is the surrounding
stratum which is used to construct the dependency graph in the worker
and then do a breadth-first search to collect all dependencies that need
to be added to the staging area.
Implementing this required a few hash/eq changes in Blob, Morphology
and Treeish as well as a few adjustments in the corresponding unit
tests.
Diffstat (limited to 'morphlib/blobs.py')
-rw-r--r-- | morphlib/blobs.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/morphlib/blobs.py b/morphlib/blobs.py index 11f3e937..4c1190fb 100644 --- a/morphlib/blobs.py +++ b/morphlib/blobs.py @@ -35,10 +35,12 @@ class Blob(object): self.dependents = [] def add_parent(self, parent): - self.parents.append(parent) + if not parent in self.parents: + self.parents.append(parent) def remove_parent(self, parent): - self.parents.remove(parent) + if parent in self.parents: + self.parents.remove(parent) def add_dependency(self, other): self.dependencies.append(other) @@ -58,6 +60,12 @@ class Blob(object): else: return { self.morph.name: ['.'] } + def __eq__(self, other): + return self.morph == other.morph + + def __hash__(self): + return hash(self.morph) + def __str__(self): # pragma: no cover return str(self.morph) |