diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/spec.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/variant.py | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 2d097bc739..0752908a38 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -2225,7 +2225,10 @@ class Spec(object): if not spec.virtual: pkg_cls = spec.package_class pkg_variants = pkg_cls.variants - not_existing = set(spec.variants) - set(pkg_variants) + # reserved names are variants that may be set on any package + # but are not necessarily recorded by the package's class + not_existing = set(spec.variants) - ( + set(pkg_variants) | set(spack.directives.reserved_names)) if not_existing: raise UnknownVariantError(spec.name, not_existing) diff --git a/lib/spack/spack/variant.py b/lib/spack/spack/variant.py index 4553bf53e4..dc47b5a65f 100644 --- a/lib/spack/spack/variant.py +++ b/lib/spack/spack/variant.py @@ -31,6 +31,7 @@ import inspect import re import llnl.util.lang as lang +import spack import spack.error as error from six import StringIO @@ -592,6 +593,8 @@ def substitute_abstract_variants(spec): spec: spec on which to operate the substitution """ for name, v in spec.variants.items(): + if name in spack.directives.reserved_names: + continue pkg_variant = spec.package_class.variants[name] new_variant = pkg_variant.make_variant(v._original_value) pkg_variant.validate_or_raise(new_variant, spec.package_class) |