diff options
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) + |