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).
This commit is contained in:
		| @@ -84,7 +84,7 @@ def get_compiler_config(arch=None): | |||||||
|         compilers = find_compilers(*get_path('PATH')) |         compilers = find_compilers(*get_path('PATH')) | ||||||
|         for compiler in compilers: |         for compiler in compilers: | ||||||
|             config[arch].update(_to_dict(compiler)) |             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. |     # Merge 'all' compilers with arch-specific ones. | ||||||
|     merged_config = config.get('all', {}) |     merged_config = config.get('all', {}) | ||||||
|   | |||||||
| @@ -193,8 +193,16 @@ def clear(self): | |||||||
|  |  | ||||||
|  |  | ||||||
| def check_scope(scope): | 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: |     if scope is None: | ||||||
|         return 'user' |         # default to the scope with highest precedence. | ||||||
|  |         return config_scopes[-1] | ||||||
|     elif scope not in valid_scopes: |     elif scope not in valid_scopes: | ||||||
|         raise ValueError("Invalid config scope: '%s'.  Must be one of %s." |         raise ValueError("Invalid config scope: '%s'.  Must be one of %s." | ||||||
|                          % (scope, valid_scopes)) |                          % (scope, valid_scopes)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin