modules : it's possible to add suffixes to module files based on constraint

This commit is contained in:
alalazo 2016-05-24 15:23:52 +02:00
parent 0890ac4507
commit 84707ed926
2 changed files with 10 additions and 2 deletions

View File

@ -287,6 +287,7 @@
'prerequisites': {'$ref': '#/definitions/dependency_selection'},
'conflict': {'$ref': '#/definitions/array_of_strings'},
'load': {'$ref': '#/definitions/array_of_strings'},
'suffixes': {'$ref': '#/definitions/dictionary_of_strings'},
'environment': {
'type': 'object',
'default': {},

View File

@ -285,11 +285,18 @@ def use_name(self):
naming_tokens = self.tokens
naming_scheme = self.naming_scheme
name = naming_scheme.format(**naming_tokens)
name += '-' + self.spec.dag_hash(
) # Always append the hash to make the module file unique
# Not everybody is working on linux...
parts = name.split('/')
name = join_path(*parts)
# Add optional suffixes based on constraints
configuration, _ = parse_config_options(self)
suffixes = [name]
for constraint, suffix in configuration.get('suffixes', {}).items():
if constraint in self.spec:
suffixes.append(suffix)
# Always append the hash to make the module file unique
suffixes.append(self.spec.dag_hash())
name = '-'.join(suffixes)
return name
@property