From 9f8ef85644883a53578fb000827cb937a16d058e Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Tue, 24 Jun 2014 07:17:30 -0700 Subject: Add more output; don't re-add existing compilers --- lib/spack/spack/cmd/compiler.py | 13 +++++++++++-- 1 file 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): -- cgit v1.2.3-70-g09d2