summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2016-02-18 00:56:29 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2016-02-18 00:56:29 -0800
commitd8a70166d3abd14b5a34025f735cf1825179f84f (patch)
tree929fc84eaade3a085dee0a6937b50eb308a32be8 /lib
parentc112cf66fe967af062baaf4eea1e8d2d91e4c645 (diff)
downloadspack-d8a70166d3abd14b5a34025f735cf1825179f84f.tar.gz
spack-d8a70166d3abd14b5a34025f735cf1825179f84f.tar.bz2
spack-d8a70166d3abd14b5a34025f735cf1825179f84f.tar.xz
spack-d8a70166d3abd14b5a34025f735cf1825179f84f.zip
Fixes #434
Compiler detection was not getting triggered properly with some of the new config logic. Adjust the conditions under which Spack will serach for compilers.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/compilers/__init__.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/lib/spack/spack/compilers/__init__.py b/lib/spack/spack/compilers/__init__.py
index 6159ef576c..3a04bc2ebc 100644
--- a/lib/spack/spack/compilers/__init__.py
+++ b/lib/spack/spack/compilers/__init__.py
@@ -74,28 +74,36 @@ def _to_dict(compiler):
def get_compiler_config(arch=None, scope=None):
"""Return the compiler configuration for the specified architecture.
"""
- # If any configuration file has compilers, just stick with the
- # ones already configured.
- config = spack.config.get_config('compilers', scope=scope)
-
+ # Check whether we're on a front-end (native) architecture.
my_arch = spack.architecture.sys_type()
if arch is None:
arch = my_arch
- if arch in config:
- return config[arch]
-
- # Only for the current arch in *highest* scope: automatically try to
- # find compilers if none are configured yet.
- if arch == my_arch and scope == 'user':
+ def init_compiler_config():
+ """Compiler search used when Spack has no compilers."""
config[arch] = {}
compilers = find_compilers(*get_path('PATH'))
for compiler in compilers:
config[arch].update(_to_dict(compiler))
spack.config.update_config('compilers', config, scope=scope)
- return config[arch]
- return {}
+ config = spack.config.get_config('compilers', scope=scope)
+
+ # Update the configuration if there are currently no compilers
+ # configured. Avoid updating automatically if there ARE site
+ # compilers configured but no user ones.
+ if arch == my_arch and arch not in config:
+ if scope is None:
+ # We know no compilers were configured in any scope.
+ init_compiler_config()
+ elif scope == 'user':
+ # Check the site config and update the user config if
+ # nothing is configured at the site level.
+ site_config = spack.config.get_config('compilers', scope='site')
+ if not site_config:
+ init_compiler_config()
+
+ return config[arch] if arch in config else {}
def add_compilers_to_config(compilers, arch=None, scope=None):