summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-01-19 14:05:48 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-01-19 14:05:48 -0800
commitf35b8b8db42332a93168e3f8a707442186359a6c (patch)
treece26fc3572d5e66206621d698a77a61c8a0af8f6 /lib
parenta4c19eee14103e9944e04917a44edec2b3209f94 (diff)
downloadspack-f35b8b8db42332a93168e3f8a707442186359a6c.tar.gz
spack-f35b8b8db42332a93168e3f8a707442186359a6c.tar.bz2
spack-f35b8b8db42332a93168e3f8a707442186359a6c.tar.xz
spack-f35b8b8db42332a93168e3f8a707442186359a6c.zip
Better location error output.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/location.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py
index 509c336b69..e422eaf966 100644
--- a/lib/spack/spack/cmd/location.py
+++ b/lib/spack/spack/cmd/location.py
@@ -23,6 +23,7 @@
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import os
+import sys
from external import argparse
import llnl.util.tty as tty
@@ -86,11 +87,12 @@ def location(parser, args):
tty.die("Spec '%s' matches no installed packages." % spec)
elif len(matching_specs) > 1:
- args = ["%s matches multiple packages." % spec,
- "Matching packages:"]
- args += [" " + str(s) for s in matching_specs]
- args += ["Use a more specific spec."]
- tty.die(*args)
+ tty.error("%s matches multiple packages:" % spec)
+ for s in matching_specs:
+ sys.stderr.write(s.tree(color=True))
+ sys.stderr.write("\n")
+ sys.stderr.write("Use a more specific spec.\n")
+ sys.exit(1)
print matching_specs[0].prefix