summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2016-03-23 15:43:16 +0100
committeralalazo <massimiliano.culpo@googlemail.com>2016-03-23 15:54:26 +0100
commit0fbdb3f65d234d6ed8f77d3732c134962ad47b35 (patch)
tree99ef611a87ac9f99d3edbaf825d150e40546e679
parentcc582dd4b435ba06dc140b1ca96b688871e36abb (diff)
downloadspack-0fbdb3f65d234d6ed8f77d3732c134962ad47b35.tar.gz
spack-0fbdb3f65d234d6ed8f77d3732c134962ad47b35.tar.bz2
spack-0fbdb3f65d234d6ed8f77d3732c134962ad47b35.tar.xz
spack-0fbdb3f65d234d6ed8f77d3732c134962ad47b35.zip
modules : added configuration file with disable keyword
-rw-r--r--lib/spack/spack/config.py28
-rw-r--r--lib/spack/spack/modules.py12
2 files changed, 35 insertions, 5 deletions
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 6afd69b3ac..6ef79c70b1 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -237,7 +237,29 @@ section_schemas = {
'type' : 'object',
'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': {
+ 'disable': {
+ 'type': 'array',
+ 'default': [],
+ 'items': {
+ 'type': 'string'
+ }
+ }
+ }
+ },
+ },
+ },
}
"""OrderedDict of config scopes keyed by name.
@@ -405,11 +427,11 @@ def _read_config_file(filename, schema):
validate_section(data, schema)
return data
- except MarkedYAMLError, e:
+ except MarkedYAMLError as e:
raise ConfigFileError(
"Error parsing yaml%s: %s" % (str(e.context_mark), e.problem))
- except IOError, e:
+ except IOError as e:
raise ConfigFileError(
"Error reading configuration file %s: %s" % (filename, str(e)))
diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py
index 8ed98e5d38..639f1101b8 100644
--- a/lib/spack/spack/modules.py
+++ b/lib/spack/spack/modules.py
@@ -48,6 +48,7 @@ import textwrap
import llnl.util.tty as tty
import spack
+import spack.config
from llnl.util.filesystem import join_path, mkdirp
from spack.environment import *
@@ -57,6 +58,13 @@ __all__ = ['EnvModule', 'Dotkit', 'TclModule']
module_types = {}
+def read_configuration_file():
+ f = spack.config.get_config('modules')
+ f.setdefault('disable', []) # Default : disable nothing
+ return f
+
+CONFIGURATION = read_configuration_file()
+
def print_help():
"""For use by commands to tell user how to activate shell support."""
@@ -115,8 +123,8 @@ class EnvModule(object):
class __metaclass__(type):
def __init__(cls, name, bases, dict):
type.__init__(cls, name, bases, dict)
- if cls.name != 'env_module':
- module_types[cls.name] = cls
+ if cls.name != 'env_module' and cls.name not in CONFIGURATION['disable']:
+ module_types[cls.name] = cls
def __init__(self, spec=None):
self.spec = spec