fixup
This commit is contained in:
parent
75f9940777
commit
36c14561a6
@ -10,6 +10,7 @@
|
|||||||
import spack.config
|
import spack.config
|
||||||
import spack.error
|
import spack.error
|
||||||
import spack.package_base
|
import spack.package_base
|
||||||
|
import spack.repo
|
||||||
import spack.spec
|
import spack.spec
|
||||||
from spack.config import get_mark_from_yaml_data
|
from spack.config import get_mark_from_yaml_data
|
||||||
|
|
||||||
@ -195,20 +196,30 @@ def reject_requirement_constraint(
|
|||||||
self, pkg_name: str, *, constraint: spack.spec.Spec, kind: RequirementKind
|
self, pkg_name: str, *, constraint: spack.spec.Spec, kind: RequirementKind
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Returns True if a requirement constraint should be rejected"""
|
"""Returns True if a requirement constraint should be rejected"""
|
||||||
if kind == RequirementKind.DEFAULT:
|
# If it's a specific package requirement, it's never rejected
|
||||||
# Requirements under all: are applied only if they are satisfiable considering only
|
if kind != RequirementKind.DEFAULT:
|
||||||
# package rules, so e.g. variants must exist etc. Otherwise, they are rejected.
|
return False
|
||||||
try:
|
|
||||||
s = spack.spec.Spec(pkg_name)
|
# Reject default requirements for runtimes and compilers
|
||||||
s.constrain(constraint)
|
if pkg_name in spack.repo.PATH.packages_with_tags("runtime"):
|
||||||
s.validate_or_raise()
|
return True
|
||||||
except spack.error.SpackError as e:
|
|
||||||
tty.debug(
|
if pkg_name in spack.repo.PATH.packages_with_tags("compiler"):
|
||||||
f"[SETUP] Rejecting the default '{constraint}' requirement "
|
return True
|
||||||
f"on '{pkg_name}': {str(e)}",
|
|
||||||
level=2,
|
# Requirements under all: are applied only if they are satisfiable considering only
|
||||||
)
|
# package rules, so e.g. variants must exist etc. Otherwise, they are rejected.
|
||||||
return True
|
try:
|
||||||
|
s = spack.spec.Spec(pkg_name)
|
||||||
|
s.constrain(constraint)
|
||||||
|
s.validate_or_raise()
|
||||||
|
except spack.error.SpackError as e:
|
||||||
|
tty.debug(
|
||||||
|
f"[SETUP] Rejecting the default '{constraint}' requirement "
|
||||||
|
f"on '{pkg_name}': {str(e)}",
|
||||||
|
level=2,
|
||||||
|
)
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user