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.py37
1 files changed, 34 insertions, 3 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 0b4e7dfacf..47ff0c5d06 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2063,7 +2063,8 @@ class Spec(object):
# still need to select a concrete package later.
if not self.virtual:
changed |= any(
- (concretizer.concretize_architecture(self),
+ (concretizer.concretize_develop(self), # special variant
+ concretizer.concretize_architecture(self),
concretizer.concretize_compiler(self),
concretizer.adjust_target(self),
# flags must be concretized after compiler
@@ -2698,6 +2699,10 @@ class Spec(object):
if user_spec_deps:
for name, spec in user_spec_deps.items():
+ if not name:
+ msg = "Attempted to normalize anonymous dependency spec"
+ msg += " %s" % spec
+ raise InvalidSpecDetected(msg)
if name not in all_spec_deps:
all_spec_deps[name] = spec
else:
@@ -2850,6 +2855,9 @@ class Spec(object):
if not other.satisfies_dependencies(self):
raise UnsatisfiableDependencySpecError(other, self)
+ if any(not d.name for d in other.traverse(root=False)):
+ raise UnconstrainableDependencySpecError(other)
+
# Handle common first-order constraints directly
changed = False
for name in self.common_dependencies(other):
@@ -4123,8 +4131,23 @@ class SpecParser(spack.parse.Parser):
if not dep:
# We're adding a dependency to the last spec
- self.expect(ID)
- dep = self.spec(self.token.value)
+ if self.accept(ID):
+ self.previous = self.token
+ if self.accept(EQ):
+ # This is an anonymous dep with a key=value
+ # push tokens to be parsed as part of the
+ # dep spec
+ self.push_tokens(
+ [self.previous, self.token])
+ dep_name = None
+ else:
+ # named dep (standard)
+ dep_name = self.token.value
+ self.previous = None
+ else:
+ # anonymous dep
+ dep_name = None
+ dep = self.spec(dep_name)
# Raise an error if the previous spec is already
# concrete (assigned by hash)
@@ -4509,6 +4532,14 @@ class UnsatisfiableDependencySpecError(spack.error.UnsatisfiableSpecError):
provided, required, "dependency")
+class UnconstrainableDependencySpecError(spack.error.SpecError):
+ """Raised when attempting to constrain by an anonymous dependency spec"""
+ def __init__(self, spec):
+ msg = "Cannot constrain by spec '%s'. Cannot constrain by a" % spec
+ msg += " spec containing anonymous dependencies"
+ super(UnconstrainableDependencySpecError, self).__init__(msg)
+
+
class AmbiguousHashError(spack.error.SpecError):
def __init__(self, msg, *specs):
spec_fmt = '{namespace}.{name}{@version}{%compiler}{compiler_flags}'