diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2014-01-08 17:39:44 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2014-01-16 16:58:24 +0000 |
commit | b5e881996901e9b5646afc58b7c7dadc82491059 (patch) | |
tree | 2ce606bfad04e8b6081b50f9757a5f2f2e89915f /morphlib/source.py | |
parent | 17628d7851fbaf284d03373e4fcfed28cb36bc59 (diff) | |
download | morph-b5e881996901e9b5646afc58b7c7dadc82491059.tar.gz |
Add split rules to sources
This introduces a new artifactsplitrule module, which tries to provide a
nice abstraction over matching a sequence of things to a bunch of
outputs, to be used by both chunks splitting, for separating files out
into chunk artifacts, the stratum splitting, where chunks are
aggregated into stratum artifacts, and systems selecting the right
strata to go into the artifact.
Diffstat (limited to 'morphlib/source.py')
-rw-r--r-- | morphlib/source.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/morphlib/source.py b/morphlib/source.py index 8673af79..75a2e4de 100644 --- a/morphlib/source.py +++ b/morphlib/source.py @@ -31,6 +31,7 @@ class Source(object): * ``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,8 +44,13 @@ class Source(object): self.tree = tree 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 morphology.builds_artifacts} + for name in self.split_rules.artifacts} def __str__(self): # pragma: no cover return '%s|%s|%s' % (self.repo_name, |