summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--morphlib/morphloader.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index 78abd9f..bc7ab6e 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']: