summaryrefslogtreecommitdiff
path: root/morphlib/morphloader.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2014-09-19 12:34:49 +0000
committerRichard Maw <richard.maw@gmail.com>2014-09-19 12:34:49 +0000
commit90b3106de52d716f0ec08c5928a921db04b2eac8 (patch)
tree074ee8beecce9f969e5a9bfa79b0f0b77866721c /morphlib/morphloader.py
parentb3dcb7963988e204d8d8651f006a6791b04b3cb6 (diff)
downloadmorph-90b3106de52d716f0ec08c5928a921db04b2eac8.tar.gz
Validate build-depends in MorphologyLoader
Diffstat (limited to 'morphlib/morphloader.py')
-rw-r--r--morphlib/morphloader.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index bc7ab6ef..8289b01e 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -536,7 +536,12 @@ class MorphologyLoader(object):
# Require build-dependencies for the stratum itself, unless
# it has chunks built in bootstrap mode.
- if 'build-depends' not in morph:
+ if 'build-depends' in morph:
+ if not isinstance(morph['build-depends'], list):
+ raise InvalidTypeError(
+ 'build-depends', list, type(morph['build-depends']),
+ morph['name'])
+ else:
for spec in morph['chunks']:
if spec.get('build-mode') in ['bootstrap', 'test']:
break
@@ -549,11 +554,15 @@ class MorphologyLoader(object):
# Require build-dependencies for each chunk.
for spec in morph['chunks']:
- if 'build-depends' not in spec:
+ chunk_name = spec.get('alias', spec['name'])
+ if 'build-depends' in spec:
+ if not isinstance(spec['build-depends'], list):
+ raise InvalidTypeError(
+ '%s.build-depends' % chunk_name, list,
+ type(spec['build-depends']), morph['name'])
+ else:
raise NoBuildDependenciesError(
- morph['name'],
- spec.get('alias', spec['name']),
- morph.filename)
+ morph['name'], chunk_name, morph.filename)
@classmethod
def _validate_chunk(cls, morphology):