Improve output for compiler commands (#3480)
* Order listed compiler sections "spack compiler list" output compiler sections in an arbitrary order. With this commit compiler sections are ordered primarily by compiler name and then by operating system and target. * Compiler search lists config files with compilers If a compiler entry is already defined in a configuration file that the user does not know about, they may be confused when that compiler is not added by "spack compiler find". This commit adds a message at the end of "spack compiler find" to inform the user of the locations of all config files where compilers are defined.
This commit is contained in:
parent
5ac6421f14
commit
19dca26f3a
@ -112,6 +112,8 @@ def compiler_find(args):
|
||||
colify(reversed(sorted(c.spec for c in new_compilers)), indent=4)
|
||||
else:
|
||||
tty.msg("Found no new compilers")
|
||||
tty.msg("Compilers are defined in the following files:")
|
||||
colify(spack.compilers.compiler_config_files(), indent=4)
|
||||
|
||||
|
||||
def compiler_remove(args):
|
||||
@ -166,7 +168,8 @@ def compiler_list(args):
|
||||
tty.msg("Available compilers")
|
||||
index = index_by(spack.compilers.all_compilers(scope=args.scope),
|
||||
lambda c: (c.spec.name, c.operating_system, c.target))
|
||||
for i, (key, compilers) in enumerate(index.items()):
|
||||
ordered_sections = sorted(index.items(), key=lambda (k, v): k)
|
||||
for i, (key, compilers) in enumerate(ordered_sections):
|
||||
if i >= 1:
|
||||
print
|
||||
name, os, target = key
|
||||
|
@ -110,6 +110,16 @@ def init_compiler_config():
|
||||
return [] # Return empty list which we will later append to.
|
||||
|
||||
|
||||
def compiler_config_files():
|
||||
config_files = list()
|
||||
for scope in spack.config.config_scopes:
|
||||
config = spack.config.get_config('compilers', scope=scope)
|
||||
if config:
|
||||
config_files.append(spack.config.config_scopes[scope]
|
||||
.get_section_filename('compilers'))
|
||||
return config_files
|
||||
|
||||
|
||||
def add_compilers_to_config(compilers, scope=None, init_config=True):
|
||||
"""Add compilers to the config for the specified architecture.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user