diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2011-11-01 14:22:42 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2011-11-01 14:22:42 +0000 |
commit | 3406f96c72714081ff0b1d90aca8189389ad40ae (patch) | |
tree | 75ee646376749d62332de5de7339a10bdec94043 | |
parent | 23b603aede1dd86cf699dd0f7cd43aae51adc870 (diff) | |
download | morph-3406f96c72714081ff0b1d90aca8189389ad40ae.tar.gz |
Make 'repo' in strata sources lists default to name of chunk
In other words, consider the follow bit of stratum morphology:
{
"name": "foo",
"kind": "stratum",
"sources": {
"bar": {
"repo": "bar",
"ref": "baserock"
}
}
}
The "repo" field duplicates the name of the key in "sources". This is
unnecessary now, so the "repo" field can be removed.
-rw-r--r-- | morphlib/morphology.py | 4 | ||||
-rw-r--r-- | morphlib/morphology_tests.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/morphlib/morphology.py b/morphlib/morphology.py index fbaa8c82..3155bf95 100644 --- a/morphlib/morphology.py +++ b/morphlib/morphology.py @@ -32,7 +32,9 @@ class Morphology(object): self._dict = json.load(self._fp) if self.kind == 'stratum': - for source in self.sources.itervalues(): + for name, source in self.sources.iteritems(): + if 'repo' not in source: + source['repo'] = name source['repo'] = self._join_with_baseurl(source['repo']) self.filename = self._fp.name diff --git a/morphlib/morphology_tests.py b/morphlib/morphology_tests.py index ccec41fc..3fefefdc 100644 --- a/morphlib/morphology_tests.py +++ b/morphlib/morphology_tests.py @@ -60,7 +60,6 @@ class MorphologyTests(unittest.TestCase): "sources": { "foo": { - "repo": "foo", "ref": "ref" } } |