Merge pull request #617 from epfl-scitas/features/disable_modules
feature : module file generation may be disabled via configuration file
This commit is contained in:
commit
f031bdfbc9
8
etc/spack/modules.yaml
Normal file
8
etc/spack/modules.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# -------------------------------------------------------------------------
|
||||||
|
# This is the default spack module files generation configuration.
|
||||||
|
#
|
||||||
|
# Changes to this file will affect all users of this spack install,
|
||||||
|
# although users can override these settings in their ~/.spack/modules.yaml.
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
modules:
|
||||||
|
enable: ['tcl', 'dotkit']
|
@ -237,7 +237,29 @@
|
|||||||
'type' : 'object',
|
'type' : 'object',
|
||||||
'default' : {},
|
'default' : {},
|
||||||
}
|
}
|
||||||
},},},},},}
|
},},},},},},
|
||||||
|
'modules': {
|
||||||
|
'$schema': 'http://json-schema.org/schema#',
|
||||||
|
'title': 'Spack module file configuration file schema',
|
||||||
|
'type': 'object',
|
||||||
|
'additionalProperties': False,
|
||||||
|
'patternProperties': {
|
||||||
|
r'modules:?': {
|
||||||
|
'type': 'object',
|
||||||
|
'default': {},
|
||||||
|
'additionalProperties': False,
|
||||||
|
'properties': {
|
||||||
|
'enable': {
|
||||||
|
'type': 'array',
|
||||||
|
'default': [],
|
||||||
|
'items': {
|
||||||
|
'type': 'string'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
"""OrderedDict of config scopes keyed by name.
|
"""OrderedDict of config scopes keyed by name.
|
||||||
@ -405,11 +427,11 @@ def _read_config_file(filename, schema):
|
|||||||
validate_section(data, schema)
|
validate_section(data, schema)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
except MarkedYAMLError, e:
|
except MarkedYAMLError as e:
|
||||||
raise ConfigFileError(
|
raise ConfigFileError(
|
||||||
"Error parsing yaml%s: %s" % (str(e.context_mark), e.problem))
|
"Error parsing yaml%s: %s" % (str(e.context_mark), e.problem))
|
||||||
|
|
||||||
except IOError, e:
|
except IOError as e:
|
||||||
raise ConfigFileError(
|
raise ConfigFileError(
|
||||||
"Error reading configuration file %s: %s" % (filename, str(e)))
|
"Error reading configuration file %s: %s" % (filename, str(e)))
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
import spack
|
import spack
|
||||||
|
import spack.config
|
||||||
from llnl.util.filesystem import join_path, mkdirp
|
from llnl.util.filesystem import join_path, mkdirp
|
||||||
from spack.environment import *
|
from spack.environment import *
|
||||||
|
|
||||||
@ -56,6 +57,8 @@
|
|||||||
# Registry of all types of modules. Entries created by EnvModule's metaclass
|
# Registry of all types of modules. Entries created by EnvModule's metaclass
|
||||||
module_types = {}
|
module_types = {}
|
||||||
|
|
||||||
|
CONFIGURATION = spack.config.get_config('modules')
|
||||||
|
|
||||||
|
|
||||||
def print_help():
|
def print_help():
|
||||||
"""For use by commands to tell user how to activate shell support."""
|
"""For use by commands to tell user how to activate shell support."""
|
||||||
@ -115,7 +118,7 @@ class EnvModule(object):
|
|||||||
class __metaclass__(type):
|
class __metaclass__(type):
|
||||||
def __init__(cls, name, bases, dict):
|
def __init__(cls, name, bases, dict):
|
||||||
type.__init__(cls, name, bases, dict)
|
type.__init__(cls, name, bases, dict)
|
||||||
if cls.name != 'env_module':
|
if cls.name != 'env_module' and cls.name in CONFIGURATION['enable']:
|
||||||
module_types[cls.name] = cls
|
module_types[cls.name] = cls
|
||||||
|
|
||||||
def __init__(self, spec=None):
|
def __init__(self, spec=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user