Skip to content
Snippets Groups Projects
Commit d8a70166 authored by Todd Gamblin's avatar Todd Gamblin
Browse files

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.
parent c112cf66
No related branches found
No related tags found
No related merge requests found
...@@ -74,28 +74,36 @@ def _to_dict(compiler): ...@@ -74,28 +74,36 @@ def _to_dict(compiler):
def get_compiler_config(arch=None, scope=None): def get_compiler_config(arch=None, scope=None):
"""Return the compiler configuration for the specified architecture. """Return the compiler configuration for the specified architecture.
""" """
# If any configuration file has compilers, just stick with the # Check whether we're on a front-end (native) architecture.
# ones already configured.
config = spack.config.get_config('compilers', scope=scope)
my_arch = spack.architecture.sys_type() my_arch = spack.architecture.sys_type()
if arch is None: if arch is None:
arch = my_arch arch = my_arch
if arch in config: def init_compiler_config():
return config[arch] """Compiler search used when Spack has no compilers."""
# 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':
config[arch] = {} config[arch] = {}
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, scope=scope) 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): def add_compilers_to_config(compilers, arch=None, scope=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment