From bef52570aee9d9e287eb46b7461fc2fbcda8a033 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Fri, 25 Dec 2015 18:42:06 -0800 Subject: [PATCH] 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). --- lib/spack/spack/compilers/__init__.py | 2 +- lib/spack/spack/config.py | 10 +++++++++- 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 @@ def clear(self): 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))