summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-03-24 02:52:45 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2016-03-24 02:52:45 -0700
commitf031bdfbc90b3f4c3a448c889ab5d047240f478e (patch)
treefb7088d0b27d39b025347cccdf9c928f5a2b9ac2
parente1848c1d28cd49278bf19ee75d337e2d2b8b77f1 (diff)
parente4adc675e58222f3082f167e709e3819beafd474 (diff)
downloadspack-f031bdfbc90b3f4c3a448c889ab5d047240f478e.tar.gz
spack-f031bdfbc90b3f4c3a448c889ab5d047240f478e.tar.bz2
spack-f031bdfbc90b3f4c3a448c889ab5d047240f478e.tar.xz
spack-f031bdfbc90b3f4c3a448c889ab5d047240f478e.zip
Merge pull request #617 from epfl-scitas/features/disable_modules
feature : module file generation may be disabled via configuration file
-rw-r--r--etc/spack/modules.yaml8
-rw-r--r--lib/spack/spack/config.py28
-rw-r--r--lib/spack/spack/modules.py5
3 files changed, 37 insertions, 4 deletions
diff --git a/etc/spack/modules.yaml b/etc/spack/modules.yaml
new file mode 100644
index 0000000000..aa2a2c3fe2
--- /dev/null
+++ b/etc/spack/modules.yaml
@@ -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']
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index 6afd69b3ac..14e5aaf4fb 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': {
+ 'enable': {
+ '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..6c32937c3c 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 *
@@ -56,6 +57,8 @@ __all__ = ['EnvModule', 'Dotkit', 'TclModule']
# Registry of all types of modules. Entries created by EnvModule's metaclass
module_types = {}
+CONFIGURATION = spack.config.get_config('modules')
+
def print_help():
"""For use by commands to tell user how to activate shell support."""
@@ -115,7 +118,7 @@ class EnvModule(object):
class __metaclass__(type):
def __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
def __init__(self, spec=None):