summaryrefslogtreecommitdiff
path: root/lib/spack/spack/spec.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/spack/spec.py')
-rw-r--r--lib/spack/spack/spec.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index fa88698ea9..095b04f837 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -106,7 +106,6 @@ from six import StringIO
from six import string_types
from six import iteritems
-import llnl.util.tty as tty
import spack
import spack.architecture
import spack.compilers as compilers
@@ -159,6 +158,7 @@ __all__ = [
'UnsatisfiableDependencySpecError',
'AmbiguousHashError',
'InvalidHashError',
+ 'NoSuchHashError',
'RedundantSpecError']
# Valid pattern for an identifier in Spack
@@ -2952,8 +2952,7 @@ class SpecParser(spack.parse.Parser):
spec.dag_hash()[:len(self.token.value)] == self.token.value]
if not matches:
- tty.die("%s does not match any installed packages." %
- self.token.value)
+ raise NoSuchHashError(self.token.value)
if len(matches) != 1:
raise AmbiguousHashError(
@@ -3325,6 +3324,12 @@ class InvalidHashError(SpecError):
% (hash, spec))
+class NoSuchHashError(SpecError):
+ def __init__(self, hash):
+ super(NoSuchHashError, self).__init__(
+ "No installed spec matches the hash: '%s'")
+
+
class RedundantSpecError(SpecError):
def __init__(self, spec, addition):
super(RedundantSpecError, self).__init__(