summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2017-01-27 11:37:21 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2017-01-27 11:37:21 -0800
commit58a4c5c14d386c862ccf5150b5ab07b57ff2b9b2 (patch)
tree74c3f1005468e3fd6b4edf6bf750f098df958c4a
parentaa7c5d111531ded399cad06f04fb973d17892c46 (diff)
downloadspack-58a4c5c14d386c862ccf5150b5ab07b57ff2b9b2.tar.gz
spack-58a4c5c14d386c862ccf5150b5ab07b57ff2b9b2.tar.bz2
spack-58a4c5c14d386c862ccf5150b5ab07b57ff2b9b2.tar.xz
spack-58a4c5c14d386c862ccf5150b5ab07b57ff2b9b2.zip
Fix ambiguous hash message generation. (#2940)
* Fix ambiguous hash message generation. Engineering fix
-rw-r--r--lib/spack/spack/spec.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 059653a72a..07e3221ed7 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2796,7 +2796,7 @@ class SpecParser(spack.parse.Parser):
if len(matches) != 1:
raise AmbiguousHashError(
- "Multiple packages specify hash beginning %s."
+ "Multiple packages specify hash beginning '%s'."
% self.token.value, *matches)
return matches[0]
@@ -3151,9 +3151,9 @@ class UnsatisfiableDependencySpecError(UnsatisfiableSpecError):
class AmbiguousHashError(SpecError):
def __init__(self, msg, *specs):
- super(AmbiguousHashError, self).__init__(msg)
- for spec in specs:
- print(' ', spec.format('$.$@$%@+$+$=$#'))
+ specs_str = '\n ' + '\n '.join(spec.format('$.$@$%@+$+$=$#')
+ for spec in specs)
+ super(AmbiguousHashError, self).__init__(msg + specs_str)
class InvalidHashError(SpecError):