builtin: remove spack.variant
imports (#50576)
Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
parent
bfc52d6f50
commit
5879724a2a
@ -208,7 +208,7 @@ def variant_type(self) -> VariantType:
|
|||||||
else:
|
else:
|
||||||
return VariantType.SINGLE
|
return VariantType.SINGLE
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self) -> str:
|
||||||
return (
|
return (
|
||||||
f"Variant('{self.name}', "
|
f"Variant('{self.name}', "
|
||||||
f"default='{self.default}', "
|
f"default='{self.default}', "
|
||||||
@ -491,14 +491,14 @@ class DisjointSetsOfValues(collections.abc.Sequence):
|
|||||||
*sets (list): mutually exclusive sets of values
|
*sets (list): mutually exclusive sets of values
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_empty_set = set(("none",))
|
_empty_set = {"none"}
|
||||||
|
|
||||||
def __init__(self, *sets):
|
def __init__(self, *sets: Tuple[str, ...]) -> None:
|
||||||
self.sets = [set(_flatten(x)) for x in sets]
|
self.sets = [set(_flatten(x)) for x in sets]
|
||||||
|
|
||||||
# 'none' is a special value and can appear only in a set of
|
# 'none' is a special value and can appear only in a set of
|
||||||
# a single element
|
# a single element
|
||||||
if any("none" in s and s != set(("none",)) for s in self.sets):
|
if any("none" in s and s != {"none"} for s in self.sets):
|
||||||
raise spack.error.SpecError(
|
raise spack.error.SpecError(
|
||||||
"The value 'none' represents the empty set,"
|
"The value 'none' represents the empty set,"
|
||||||
" and must appear alone in a set. Use the "
|
" and must appear alone in a set. Use the "
|
||||||
|
@ -5,16 +5,10 @@
|
|||||||
from spack_repo.builtin.build_systems.cmake import CMakePackage
|
from spack_repo.builtin.build_systems.cmake import CMakePackage
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
from spack.variant import ConditionalVariantValues
|
|
||||||
|
|
||||||
|
|
||||||
def _std_when(values):
|
def _std_when(values):
|
||||||
for v in values:
|
return [(c.value, c.when) for v in values for c in v]
|
||||||
if isinstance(v, ConditionalVariantValues):
|
|
||||||
for c in v:
|
|
||||||
yield (c.value, c.when)
|
|
||||||
else:
|
|
||||||
yield (v, "")
|
|
||||||
|
|
||||||
|
|
||||||
class Geant4(CMakePackage):
|
class Geant4(CMakePackage):
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class Hipblas(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ class Hipcub(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class Hipfft(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class Hiprand(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -62,7 +61,7 @@ class Hipsolver(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ class Hipsparse(CMakePackage, CudaPackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
from spack_repo.builtin.build_systems.cmake import CMakePackage
|
from spack_repo.builtin.build_systems.cmake import CMakePackage
|
||||||
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
from spack_repo.builtin.build_systems.rocm import ROCmPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ class Hipsparselt(CMakePackage, ROCmPackage):
|
|||||||
variant(
|
variant(
|
||||||
"amdgpu_target",
|
"amdgpu_target",
|
||||||
description="AMD GPU architecture",
|
description="AMD GPU architecture",
|
||||||
values=spack.variant.DisjointSetsOfValues(("auto",), ("none",), amdgpu_targets)
|
values=disjoint_sets(("auto",), amdgpu_targets)
|
||||||
.with_default("auto")
|
.with_default("auto")
|
||||||
.with_error(
|
.with_error(
|
||||||
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
"the values 'auto' and 'none' are mutually exclusive with any of the other values"
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
from spack_repo.builtin.build_systems import meson
|
from spack_repo.builtin.build_systems import meson
|
||||||
from spack_repo.builtin.build_systems.meson import MesonPackage
|
from spack_repo.builtin.build_systems.meson import MesonPackage
|
||||||
|
|
||||||
import spack.variant
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -85,9 +84,7 @@ class Mesa(MesonPackage):
|
|||||||
# @:21 - swr was removed in 22.0
|
# @:21 - swr was removed in 22.0
|
||||||
variant(
|
variant(
|
||||||
"swr",
|
"swr",
|
||||||
values=spack.variant.DisjointSetsOfValues(
|
values=disjoint_sets(("none",), ("auto",), ("avx", "avx2", "knl", "skx"))
|
||||||
("none",), ("auto",), ("avx", "avx2", "knl", "skx")
|
|
||||||
)
|
|
||||||
.with_non_feature_values("auto")
|
.with_non_feature_values("auto")
|
||||||
.with_non_feature_values("none")
|
.with_non_feature_values("none")
|
||||||
.with_default("auto"),
|
.with_default("auto"),
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
from spack_repo.builtin.build_systems.generic import Package
|
from spack_repo.builtin.build_systems.generic import Package
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
from spack.variant import DisjointSetsOfValues
|
|
||||||
|
|
||||||
|
|
||||||
class Spack(Package):
|
class Spack(Package):
|
||||||
@ -48,17 +47,15 @@ class Spack(Package):
|
|||||||
variant("development_tools", default=False, description="Build development dependencies")
|
variant("development_tools", default=False, description="Build development dependencies")
|
||||||
variant(
|
variant(
|
||||||
"fetchers",
|
"fetchers",
|
||||||
# TODO: make Spack support default=... with any_combination_of :(
|
values=any_combination_of("curl", "git", "mercurial", "subversion", "s3").with_default(
|
||||||
values=DisjointSetsOfValues(
|
"git"
|
||||||
("none",), ("curl", "git", "mercurial", "subversion", "s3")
|
),
|
||||||
).with_default("git"),
|
|
||||||
description="Fetchers for sources and binaries. "
|
description="Fetchers for sources and binaries. "
|
||||||
"By default, urllib is used since Spack 0.17",
|
"By default, urllib is used since Spack 0.17",
|
||||||
)
|
)
|
||||||
variant(
|
variant(
|
||||||
"modules",
|
"modules",
|
||||||
# TODO: make Spack support default=... with any_combination_of :(
|
values=any_combination_of("environment-modules", "lmod").with_default(
|
||||||
values=DisjointSetsOfValues(("none",), ("environment-modules", "lmod")).with_default(
|
|
||||||
"environment-modules,lmod"
|
"environment-modules,lmod"
|
||||||
),
|
),
|
||||||
description="This variant makes Spack install the specified module system; "
|
description="This variant makes Spack install the specified module system; "
|
||||||
|
@ -7,16 +7,15 @@
|
|||||||
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
from spack_repo.builtin.build_systems.cuda import CudaPackage
|
||||||
|
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
from spack.variant import ConditionalVariantValues
|
|
||||||
|
|
||||||
|
|
||||||
def _std_when(values):
|
def _std_when(values):
|
||||||
for v in values:
|
for v in values:
|
||||||
if isinstance(v, ConditionalVariantValues):
|
if isinstance(v, str):
|
||||||
for c in v:
|
yield v, ""
|
||||||
yield (c.value, c.when)
|
continue
|
||||||
else:
|
for c in v:
|
||||||
yield (v, "")
|
yield c.value, c.when
|
||||||
|
|
||||||
|
|
||||||
class Vecgeom(CMakePackage, CudaPackage):
|
class Vecgeom(CMakePackage, CudaPackage):
|
||||||
|
Loading…
Reference in New Issue
Block a user