spec.py: remove VariantMap.concrete (#49170)
VariantMap.concrete is unused, and would be incorrect if it were used due to conditional variants. Just let the Spec dictate what is concrete and what is not.
This commit is contained in:
parent
3ad99d75f9
commit
4e311a22d0
@ -4615,17 +4615,6 @@ def constrain(self, other: "VariantMap") -> bool:
|
||||
|
||||
return changed
|
||||
|
||||
@property
|
||||
def concrete(self):
|
||||
"""Returns True if the spec is concrete in terms of variants.
|
||||
|
||||
Returns:
|
||||
bool: True or False
|
||||
"""
|
||||
return self.spec._concrete or all(
|
||||
v in self for v in spack.repo.PATH.get_pkg_class(self.spec.fullname).variant_names()
|
||||
)
|
||||
|
||||
def copy(self) -> "VariantMap":
|
||||
clone = VariantMap(self.spec)
|
||||
for name, variant in self.items():
|
||||
|
@ -685,22 +685,6 @@ def test_str(self) -> None:
|
||||
c["shared"] = BoolValuedVariant("shared", True)
|
||||
assert str(c) == "+shared feebar=foo foo=bar,baz foobar=fee"
|
||||
|
||||
def test_concrete(self, mock_packages, config) -> None:
|
||||
spec = Spec("pkg-a")
|
||||
assert not VariantMap(spec).concrete
|
||||
|
||||
# concrete if associated spec is concrete
|
||||
spec = spack.concretize.concretize_one(spec)
|
||||
assert VariantMap(spec).concrete
|
||||
|
||||
# concrete if all variants are present (even if spec not concrete)
|
||||
spec._mark_concrete(False)
|
||||
assert spec.variants.concrete
|
||||
|
||||
# remove a variant to test the condition
|
||||
del spec.variants["foo"]
|
||||
assert not spec.variants.concrete
|
||||
|
||||
|
||||
def test_disjoint_set_initialization_errors():
|
||||
# Constructing from non-disjoint sets should raise an exception
|
||||
|
Loading…
Reference in New Issue
Block a user