summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/cmd/compiler.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/compiler.py b/lib/spack/spack/cmd/compiler.py
index 0586484c32..a4cd2df7e2 100644
--- a/lib/spack/spack/cmd/compiler.py
+++ b/lib/spack/spack/cmd/compiler.py
@@ -60,8 +60,17 @@ def compiler_add(args):
if not paths:
paths = get_path('PATH')
- compilers = spack.compilers.find_compilers(*args.add_paths)
- spack.compilers.add_compilers_to_config('user', *compilers)
+ 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_filename('user')))
+ colify(reversed(sorted(c.spec for c in compilers)), indent=4)
+ else:
+ tty.msg("Found no new compilers")
def compiler_remove(args):