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.py46
1 files changed, 6 insertions, 40 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 602f2fd878..b4b80dab6f 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -1012,12 +1012,9 @@ class Spec(object):
self._hash = other._hash
self._cmp_key_cache = other._cmp_key_cache
- # Specs are by default not assumed to be normal, but in some
- # cases we've read them from a file want to assume normal.
- # This allows us to manipulate specs that Spack doesn't have
- # package.py files for.
- self._normal = kwargs.get('normal', False)
- self._concrete = kwargs.get('concrete', False)
+ # Specs are by default not assumed to be normal or concrete.
+ self._normal = False
+ self._concrete = False
# Allow a spec to be constructed with an external path.
self.external_path = kwargs.get('external_path', None)
@@ -1099,13 +1096,14 @@ class Spec(object):
assert(self.compiler_flags is not None)
self.compiler_flags[name] = value.split()
else:
+ # FIXME:
# All other flags represent variants. 'foo=true' and 'foo=false'
# map to '+foo' and '~foo' respectively. As such they need a
# BoolValuedVariant instance.
if str(value).upper() == 'TRUE' or str(value).upper() == 'FALSE':
self.variants[name] = BoolValuedVariant(name, value)
else:
- self.variants[name] = MultiValuedVariant(name, value)
+ self.variants[name] = AbstractVariant(name, value)
def _set_architecture(self, **kwargs):
"""Called by the parser to set the architecture."""
@@ -1892,18 +1890,6 @@ class Spec(object):
# evaluate when specs to figure out constraints on the dependency.
dep = None
for when_spec, dep_spec in conditions.items():
- # If self was concrete it would have changed the variants in
- # when_spec automatically. As here we are for sure during the
- # concretization process, self is not concrete and we must change
- # the variants in when_spec on our own to avoid using a
- # MultiValuedVariant whe it is instead a SingleValuedVariant
- try:
- substitute_single_valued_variants(when_spec)
- except SpecError as e:
- msg = 'evaluating a `when=` statement gives ' + e.message
- e.message = msg
- raise
-
sat = self.satisfies(when_spec, strict=True)
if sat:
if dep is None:
@@ -2131,7 +2117,6 @@ class Spec(object):
if not compilers.supported(spec.compiler):
raise UnsupportedCompilerError(spec.compiler.name)
- # FIXME: Move the logic below into the variant.py module
# Ensure correctness of variants (if the spec is not virtual)
if not spec.virtual:
pkg_cls = spec.package_class
@@ -2140,7 +2125,7 @@ class Spec(object):
if not_existing:
raise UnknownVariantError(spec.name, not_existing)
- substitute_single_valued_variants(spec)
+ substitute_abstract_variants(spec)
def constrain(self, other, deps=True):
"""Merge the constraints of other with self.
@@ -2351,24 +2336,6 @@ class Spec(object):
elif strict and (other.compiler and not self.compiler):
return False
- # If self is a concrete spec, and other is not virtual, then we need
- # to substitute every multi-valued variant that needs it with a
- # single-valued variant.
- if self.concrete:
- try:
- # When parsing a spec every variant of the form
- # 'foo=value' will be interpreted by default as a
- # multi-valued variant. During validation of the
- # variants we use the information in the package
- # to turn any variant that needs it to a single-valued
- # variant.
- substitute_single_valued_variants(other)
- except (SpecError, KeyError):
- # Catch the two things that could go wrong above:
- # 1. name is not a valid variant (KeyError)
- # 2. the variant is not validated (SpecError)
- return False
-
var_strict = strict
if (not self.name) or (not other.name):
var_strict = True
@@ -3209,7 +3176,6 @@ class SpecParser(spack.parse.Parser):
return spec
def variant(self, name=None):
- # TODO: Make generalized variants possible
if name:
return name
else: