Skip to content

Commit

Permalink
messing around with configurations validation
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Feb 27, 2025
1 parent 957a4c8 commit 9b6c462
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/access3-exe/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
# SPDX-License-Identifier: Apache-2.0

from spack.package import *
from spack.variant import any_combination_of
from spack.variant import auto_or_any_combination_of



class Access3Exe(CMakePackage):
"""Executable build for ACCESS version 3 climate models. The exectuable is defined in Community Mediator for Earth Prediction
Expand All @@ -20,18 +22,15 @@ class Access3Exe(CMakePackage):

variant(
"configurations",
# default="MOM6-CICE6, CICE6-WW3, MOM6-CICE6-WW3", if we set these defaults there is no way to unset them in the deployment
# default="CICE6",
values=any_combination_of(
values=auto_or_any_combination_of(
"MOM6",
"CICE6",
"WW3",
"MOM6-WW3",
"MOM6-CICE6",
"CICE6-WW3",
"MOM6-CICE6-WW3",
).prohibit_empty_set().with_error("at least one configuration to build is required (e.g. MOM6-CICE6)"),
# multi=True,
),
description="ACCESS-OM3 configurations to build",
)

Expand All @@ -52,7 +51,10 @@ class Access3Exe(CMakePackage):
def cmake_args(self):

# make configurations a cmake argument
buildConf = ";".join(self.spec.variants["configurations"].value)
if self.spec.satisfies("configurations=auto"):
buildConf = "MOM6;MOM6-CICE6;MOM6-CICE6-WW3"
else:
buildConf = ";".join(self.spec.variants["configurations"].value)
args = [
self.define("BuildConfigurations",buildConf)

Check failure on line 59 in packages/access3-exe/package.py

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E231)

packages/access3-exe/package.py:59:46: E231 Missing whitespace after ','
]
Expand Down

0 comments on commit 9b6c462

Please sign in to comment.