eccodes: rename variant 'definitions' to 'extra_definitions' (#36186)

This commit is contained in:
Sergey Kosukhin 2023-11-02 20:28:31 +01:00 committed by GitHub
parent fa08de669e
commit 6b236f130c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -81,17 +81,9 @@ class Eccodes(CMakePackage):
variant("shared", default=True, description="Build shared versions of the libraries")
variant(
"definitions",
values=disjoint_sets(("auto",), ("default",) + tuple(_definitions.keys())).with_default(
"auto"
),
description="List of definitions to install",
)
variant(
"samples",
values=disjoint_sets(("auto",), ("default",)).with_default("auto"),
description="List of samples to install",
"extra_definitions",
values=any_combination_of(*_definitions.keys()),
description="List of extra definitions to install",
)
depends_on("netcdf-c", when="+netcdf")
@ -132,7 +124,7 @@ class Eccodes(CMakePackage):
for center, definitions in _definitions.items():
kwargs = definitions.get("conflicts", None)
if kwargs:
conflicts("definitions={0}".format(center), **kwargs)
conflicts("extra_definitions={0}".format(center), **kwargs)
for kwargs in definitions.get("resources", []):
resource(
name=center,
@ -357,25 +349,12 @@ def cmake_args(self):
if "+memfs" in self.spec:
args.append(self.define("PYTHON_EXECUTABLE", python.path))
definitions = self.spec.variants["definitions"].value
if "auto" not in definitions:
args.append(
self.define("ENABLE_INSTALL_ECCODES_DEFINITIONS", "default" in definitions)
)
samples = self.spec.variants["samples"].value
if "auto" not in samples:
args.append(self.define("ENABLE_INSTALL_ECCODES_SAMPLES", "default" in samples))
return args
@run_after("install")
def install_extra_definitions(self):
noop = set(["auto", "none", "default"])
for center in self.spec.variants["definitions"].value:
if center not in noop:
for center in self.spec.variants["extra_definitions"].value:
if center != "none":
center_dir = "definitions.{0}".format(center)
install_tree(
join_path(self.stage.source_path, "spack-definitions", center_dir),