diff options
author | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2014-08-15 17:20:29 +0000 |
---|---|---|
committer | Francisco Redondo Marchena <francisco.marchena@codethink.co.uk> | 2014-08-15 17:25:44 +0000 |
commit | dbc508a019a55b31bf4481225894aca8340747a2 (patch) | |
tree | 95eec90a7545b8d7e887966ce07298e7aaa442cb | |
parent | b3b8cd5c55d608fd0a1262975b7ea3f15344bf10 (diff) | |
download | morph-dbc508a019a55b31bf4481225894aca8340747a2.tar.gz |
Fix morphloader to unset_defaults for chunks
-rw-r--r-- | morphlib/morphloader.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py index 78abd9fe..bc7ab6ef 100644 --- a/morphlib/morphloader.py +++ b/morphlib/morphloader.py @@ -692,8 +692,7 @@ class MorphologyLoader(object): if key in morphology and morphology[key] == defaults[key]: del morphology[key] - if kind in ('system', 'stratum', 'cluster'): - getattr(self, '_unset_%s_defaults' % kind)(morphology) + getattr(self, '_unset_%s_defaults' % kind)(morphology) @classmethod def _set_stratum_specs_defaults(cls, morphology, specs_field): @@ -757,6 +756,18 @@ class MorphologyLoader(object): if morph['max-jobs'] is not None: morph['max-jobs'] = int(morph['max-jobs']) + def _unset_chunk_defaults(self, morph): # pragma: no cover + for key in self._static_defaults['chunk']: + if key not in morph: continue + if 'commands' not in key: continue + attr = key.replace('-', '_') + default_bs = self._static_defaults['chunk']['build-system'] + bs = morphlib.buildsystem.lookup_build_system( + morph.get('build-system', default_bs)) + default_value = getattr(bs, attr) + if morph[key] == default_value: + del morph[key] + def set_commands(self, morph): if morph['kind'] == 'chunk': for key in self._static_defaults['chunk']: |