summaryrefslogtreecommitdiff
path: root/morphlib/source.py
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib/source.py')
-rw-r--r--morphlib/source.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/morphlib/source.py b/morphlib/source.py
index 99b0a993..75a2e4de 100644
--- a/morphlib/source.py
+++ b/morphlib/source.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2013 Codethink Limited
+# Copyright (C) 2012-2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -30,6 +30,8 @@ class Source(object):
* ``tree`` -- the SHA1 of the tree corresponding to the commit
* ``morphology`` -- the in-memory representation of the morphology we use
* ``filename`` -- basename of the morphology filename
+ * ``artifacts`` -- the set of artifacts this source produces.
+ * ``split_rules`` -- rules for splitting the source's produced artifacts
'''
@@ -43,6 +45,13 @@ class Source(object):
self.morphology = morphology
self.filename = filename
+ kind = morphology['kind']
+ unifier = getattr(morphlib.artifactsplitrule,
+ 'unify_%s_matches' % kind)
+ self.split_rules = unifier(morphology)
+ self.artifacts = {name: morphlib.artifact.Artifact(self, name)
+ for name in self.split_rules.artifacts}
+
def __str__(self): # pragma: no cover
return '%s|%s|%s' % (self.repo_name,
self.original_ref,