modules : started working on naming schemes and conflict
This commit is contained in:
parent
1b4c4be151
commit
00f44d558a
@ -297,6 +297,9 @@
|
|||||||
'properties': {
|
'properties': {
|
||||||
'whitelist': {'$ref': '#/definitions/array_of_strings'},
|
'whitelist': {'$ref': '#/definitions/array_of_strings'},
|
||||||
'blacklist': {'$ref': '#/definitions/array_of_strings'},
|
'blacklist': {'$ref': '#/definitions/array_of_strings'},
|
||||||
|
'naming_scheme': {
|
||||||
|
'type': 'string' # Can we be more specific here?
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -322,7 +325,11 @@
|
|||||||
'tcl': {
|
'tcl': {
|
||||||
'allOf': [
|
'allOf': [
|
||||||
{'$ref': '#/definitions/module_type_configuration'}, # Base configuration
|
{'$ref': '#/definitions/module_type_configuration'}, # Base configuration
|
||||||
{} # Specific tcl extensions
|
{
|
||||||
|
'properties': {
|
||||||
|
'conflict': {'type': 'string'}
|
||||||
|
}
|
||||||
|
} # Specific tcl extensions
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
'dotkit': {
|
'dotkit': {
|
||||||
|
@ -41,11 +41,11 @@
|
|||||||
Each hook in hooks/ implements the logic for writing its specific type of module file.
|
Each hook in hooks/ implements the logic for writing its specific type of module file.
|
||||||
"""
|
"""
|
||||||
import copy
|
import copy
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
import datetime
|
|
||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import spack
|
import spack
|
||||||
@ -75,7 +75,7 @@ def print_help():
|
|||||||
" . %s/setup-env.sh" % spack.share_path,
|
" . %s/setup-env.sh" % spack.share_path,
|
||||||
"",
|
"",
|
||||||
"For csh and tcsh:",
|
"For csh and tcsh:",
|
||||||
" setenv SPACK_ROOT %s" % spack.prefix,
|
" setenv SPACK_ROOT %s" % spack.prefix,
|
||||||
" source %s/setup-env.csh" % spack.share_path,
|
" source %s/setup-env.csh" % spack.share_path,
|
||||||
"")
|
"")
|
||||||
|
|
||||||
@ -263,6 +263,34 @@ def __init__(self, spec=None):
|
|||||||
if self.spec.package.__doc__:
|
if self.spec.package.__doc__:
|
||||||
self.long_description = re.sub(r'\s+', ' ', self.spec.package.__doc__)
|
self.long_description = re.sub(r'\s+', ' ', self.spec.package.__doc__)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def naming_scheme(self):
|
||||||
|
try:
|
||||||
|
naming_scheme = CONFIGURATION[self.name]['naming_scheme']
|
||||||
|
except KeyError:
|
||||||
|
naming_scheme = self.default_naming_format
|
||||||
|
return naming_scheme
|
||||||
|
|
||||||
|
@property
|
||||||
|
def tokens(self):
|
||||||
|
tokens = {
|
||||||
|
'name': self.spec.name,
|
||||||
|
'version': self.spec.version,
|
||||||
|
'compiler': self.spec.compiler,
|
||||||
|
'hash': self.spec.dag_hash()
|
||||||
|
}
|
||||||
|
return tokens
|
||||||
|
|
||||||
|
@property
|
||||||
|
def use_name(self):
|
||||||
|
"""
|
||||||
|
Subclasses should implement this to return the name the module command uses to refer to the package.
|
||||||
|
"""
|
||||||
|
naming_tokens = self.tokens
|
||||||
|
naming_scheme = self.naming_scheme
|
||||||
|
name = naming_scheme.format(**naming_tokens)
|
||||||
|
return name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def category(self):
|
def category(self):
|
||||||
# Anything defined at the package level takes precedence
|
# Anything defined at the package level takes precedence
|
||||||
@ -379,12 +407,6 @@ def file_name(self):
|
|||||||
where this module lives."""
|
where this module lives."""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
|
||||||
def use_name(self):
|
|
||||||
"""Subclasses should implement this to return the name the
|
|
||||||
module command uses to refer to the package."""
|
|
||||||
raise NotImplementedError()
|
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
mod_file = self.file_name
|
mod_file = self.file_name
|
||||||
if os.path.exists(mod_file):
|
if os.path.exists(mod_file):
|
||||||
@ -408,17 +430,12 @@ class Dotkit(EnvModule):
|
|||||||
|
|
||||||
prerequisite_format = None # TODO : does something like prerequisite exist for dotkit?
|
prerequisite_format = None # TODO : does something like prerequisite exist for dotkit?
|
||||||
|
|
||||||
|
default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}-{hash}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def file_name(self):
|
def file_name(self):
|
||||||
return join_path(Dotkit.path, self.spec.architecture, '%s.dk' % self.use_name)
|
return join_path(Dotkit.path, self.spec.architecture, '%s.dk' % self.use_name)
|
||||||
|
|
||||||
@property
|
|
||||||
def use_name(self):
|
|
||||||
return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
|
|
||||||
self.spec.compiler.name,
|
|
||||||
self.spec.compiler.version,
|
|
||||||
self.spec.dag_hash())
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def header(self):
|
def header(self):
|
||||||
# Category
|
# Category
|
||||||
@ -456,17 +473,12 @@ class TclModule(EnvModule):
|
|||||||
|
|
||||||
prerequisite_format = 'prereq {module_file}\n'
|
prerequisite_format = 'prereq {module_file}\n'
|
||||||
|
|
||||||
|
default_naming_format = '{name}-{version}-{compiler.name}-{compiler.version}-{hash}'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def file_name(self):
|
def file_name(self):
|
||||||
return join_path(TclModule.path, self.spec.architecture, self.use_name)
|
return join_path(TclModule.path, self.spec.architecture, self.use_name)
|
||||||
|
|
||||||
@property
|
|
||||||
def use_name(self):
|
|
||||||
return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
|
|
||||||
self.spec.compiler.name,
|
|
||||||
self.spec.compiler.version,
|
|
||||||
self.spec.dag_hash())
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def header(self):
|
def header(self):
|
||||||
# TCL Modulefile header
|
# TCL Modulefile header
|
||||||
|
Loading…
Reference in New Issue
Block a user