summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-12-25 18:42:06 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-12-25 18:42:06 -0800
commitbef52570aee9d9e287eb46b7461fc2fbcda8a033 (patch)
tree00a7e9e24b18c3aee54525dd311c23f56180f2c6 /lib
parentc65fd3a28968f549eed361d85f715caa4f8f6436 (diff)
downloadspack-bef52570aee9d9e287eb46b7461fc2fbcda8a033.tar.gz
spack-bef52570aee9d9e287eb46b7461fc2fbcda8a033.tar.bz2
spack-bef52570aee9d9e287eb46b7461fc2fbcda8a033.tar.xz
spack-bef52570aee9d9e287eb46b7461fc2fbcda8a033.zip
Default to scope with highest precedence instead of user scope,
- Generalizes config scopes a bit more: nothing assumes there is a 'user' scope (this would break testing sometimes).
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/__init__.py2
-rw-r--r--lib/spack/spack/config.py10
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 321452fddb..a1b6d978df 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -84,7 +84,7 @@ def get_compiler_config(arch=None):
compilers = find_compilers(*get_path('PATH'))
for compiler in compilers:
config[arch].update(_to_dict(compiler))
- spack.config.update_config('compilers', config, 'user')
+ spack.config.update_config('compilers', config)
# Merge 'all' compilers with arch-specific ones.
merged_config = config.get('all', {})
diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py
index b401f59d7f..aa6afd183e 100644
--- a/lib/spack/spack/config.py
+++ b/lib/spack/spack/config.py
@@ -193,8 +193,16 @@ valid_scopes = (s.name for s in config_scopes)
def check_scope(scope):
+ """Ensure that scope is valid, and return a valid scope if it is None.
+
+ This should be used by routines in ``config.py`` to validate
+ scope name arguments, and to determine a default scope where no
+ scope is specified.
+
+ """
if scope is None:
- return 'user'
+ # default to the scope with highest precedence.
+ return config_scopes[-1]
elif scope not in valid_scopes:
raise ValueError("Invalid config scope: '%s'. Must be one of %s."
% (scope, valid_scopes))