diff options
author | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-04-16 17:03:53 +0100 |
---|---|---|
committer | Jannis Pohlmann <jannis.pohlmann@codethink.co.uk> | 2012-04-16 17:04:20 +0100 |
commit | 9a0976b32c8362de0ad70283f5d4ab3675706564 (patch) | |
tree | b42e2d1a9a928ed47518135cd17e87fd26d446be /morphlib/artifact.py | |
parent | 31b887e4fa73920ea2c0c95160eabdc758f4fde0 (diff) | |
download | morph-9a0976b32c8362de0ad70283f5d4ab3675706564.tar.gz |
Merge DependencyResolver into ArtifactResolver.
Diffstat (limited to 'morphlib/artifact.py')
-rw-r--r-- | morphlib/artifact.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/morphlib/artifact.py b/morphlib/artifact.py index 9403f081..830ee1ac 100644 --- a/morphlib/artifact.py +++ b/morphlib/artifact.py @@ -20,8 +20,21 @@ class Artifact(object): self.source = source self.name = name self.cache_key = cache_key + self.dependencies = [] + self.dependents = [] + + def add_dependency(self, artifact): + '''Add ``artifact`` to the dependency list.''' + if artifact not in self.dependencies: + self.dependencies.append(artifact) + artifact.dependents.append(self) + + def depends_on(self, artifact): + '''Do we depend on ``artifact``?''' + return artifact in self.dependencies def __str__(self): # pragma: no cover return '%s.%s.%s' % (self.cache_key, self.source.morphology['kind'], self.name) + |