diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py index cbe3aba864..3e86928977 100644 --- a/lib/spack/spack/cmd/compiler.py +++ b/lib/spack/spack/cmd/compiler.py @@ -38,7 +38,6 @@ from spack.spec import CompilerSpec description = "Manage compilers" -ARCHITECTURE = spack.architecture.sys_type() def setup_parser(subparser): sp = subparser.add_subparsers(metavar='SUBCOMMAND', dest='compiler_command') @@ -59,30 +58,23 @@ def compiler_add(args): """Search either $PATH or a list of paths OR MODULES for compilers and add them to Spack's configuration.""" - strategies = ARCHITECTURE.strategy() - for strategy in strategies: - if strategy == 'PATH': - paths = args.add_paths # This might be a parser method. Parsing method to add_paths - if not paths: - paths = get_path('PATH') - - compilers = [c for c in spack.compilers.find_compilers(*args.add_paths) - if c.spec not in spack.compilers.all_compilers()] - - elif strategy == "MODULES": - from spack.compilers.cray import Cray - compilers = Cray.find_in_modules() - #TODO: Find a way to locate the executables + paths = args.add_paths # This might be a parser method. Parsing method to add_paths + if not paths: + paths = get_path('PATH') + + compilers = [c for c in spack.compilers.find_compilers(*args.add_paths) + if c.spec not in spack.compilers.all_compilers()] - if compilers: - spack.compilers.add_compilers_to_config('user', *compilers) - n = len(compilers) - tty.msg("Added %d new compiler%s to %s" % ( - n, 's' if n > 1 else '', spack.config.get_config_scope_filename('user', 'compilers'))) - colify(reversed(sorted(c.spec for c in compilers)), indent=4) - else: - tty.msg("Found no new compilers") + + if compilers: + spack.compilers.add_compilers_to_config('user', *compilers) + n = len(compilers) + tty.msg("Added %d new compiler%s to %s" % ( + n, 's' if n > 1 else '', spack.config.get_config_scope_filename('user', 'compilers'))) + colify(reversed(sorted(c.spec for c in compilers)), indent=4) + else: + tty.msg("Found no new compilers") def compiler_remove(args):