summaryrefslogtreecommitdiff
path: root/morphlib/morphloader.py
diff options
context:
space:
mode:
authorTiago Gomes <tiago.gomes@codethink.co.uk>2015-12-07 10:36:28 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-12-21 10:50:04 +0000
commit7d5804051531147298085d4db1b81ffd4b3c10c6 (patch)
tree5d954f8a22df6fc033b3f9dbfb762ce05fffacb5 /morphlib/morphloader.py
parent6633cfd90eba8aa232f3ddaf778ab31362cb64da (diff)
downloadmorph-7d5804051531147298085d4db1b81ffd4b3c10c6.tar.gz
morphloader: remove unset functions
Change-Id: I2a9177245e8cd4eac54ef8a2079eaed2e98e88e7
Diffstat (limited to 'morphlib/morphloader.py')
-rw-r--r--morphlib/morphloader.py50
1 files changed, 0 insertions, 50 deletions
diff --git a/morphlib/morphloader.py b/morphlib/morphloader.py
index fef56ca3..05ffd0b8 100644
--- a/morphlib/morphloader.py
+++ b/morphlib/morphloader.py
@@ -685,21 +685,6 @@ class MorphologyLoader(object):
getattr(self, '_set_%s_defaults' % kind)(morphology)
- def unset_defaults(self, morphology):
- '''If a field is equal to its default, delete it.
-
- The morphology is assumed to be valid.
-
- '''
-
- kind = morphology['kind']
- defaults = self._static_defaults[kind]
- for key in defaults:
- if key in morphology and morphology[key] == defaults[key]:
- del morphology[key]
-
- getattr(self, '_unset_%s_defaults' % kind)(morphology)
-
def _set_cluster_defaults(self, morph):
for system in morph.get('systems', []):
if 'deploy-defaults' not in system:
@@ -707,19 +692,9 @@ class MorphologyLoader(object):
if 'deploy' not in system:
system['deploy'] = {}
- def _unset_cluster_defaults(self, morph):
- for system in morph.get('systems', []):
- if 'deploy-defaults' in system and system['deploy-defaults'] == {}:
- del system['deploy-defaults']
- if 'deploy' in system and system['deploy'] == {}:
- del system['deploy']
-
def _set_system_defaults(self, morph):
pass
- def _unset_system_defaults(self, morph):
- pass
-
def _set_stratum_defaults(self, morph):
for spec in morph['chunks']:
if 'repo' not in spec:
@@ -731,35 +706,10 @@ class MorphologyLoader(object):
spec['prefix'] = \
self._static_defaults['chunk']['prefix']
- def _unset_stratum_defaults(self, morph):
- for spec in morph['chunks']:
- if 'repo' in spec and spec['repo'] == spec['name']:
- del spec['repo']
- if 'build-mode' in spec and spec['build-mode'] == \
- self._static_defaults['chunk']['build-mode']:
- del spec['build-mode']
- if 'prefix' in spec and spec['prefix'] == \
- self._static_defaults['chunk']['prefix']:
- del spec['prefix']
-
def _set_chunk_defaults(self, morph):
if morph['max-jobs'] is not None:
morph['max-jobs'] = int(morph['max-jobs'])
- def _unset_chunk_defaults(self, morph): # pragma: no cover
- # This is only used by the deprecated branch-and-merge plugin, and
- # probably doesn't work correctly for definitions V7 and newer.
- default_bs = self._static_defaults['chunk']['build-system']
- bs_name = morph.get('build-system', default_bs)
- bs = self.lookup_build_system(bs_name)
- for key in self._static_defaults['chunk']:
- if key not in morph: continue
- if 'commands' not in key: continue
- attr = key.replace('-', '_')
- default_value = getattr(bs, attr)
- if morph[key] == default_value:
- del morph[key]
-
def lookup_build_system(self, name):
return self._predefined_build_systems[name]