Skip to content

Commit

Permalink
fix handing of deps
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-seaice committed Mar 4, 2025
1 parent 9b6c462 commit 2b84afc
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/access-om3-nuopc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AccessOm3Nuopc(CMakePackage):
"cice_io",
default="PIO",
description="CICE IO option",
values=("NectCDF", "PIO", "Binary"),
values=("NetCDF", "PIO", "Binary"),
multi=False,
)

Expand Down
59 changes: 38 additions & 21 deletions packages/access3-exe/package.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: Apache-2.0

from spack.package import *
from spack.variant import auto_or_any_combination_of
from spack.variant import disjoint_sets, auto_or_any_combination_of

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

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (F401)

packages/access3-exe/package.py:7:27: F401 `spack.variant.disjoint_sets` imported but unused

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

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (F401)

packages/access3-exe/package.py:7:42: F401 `spack.variant.auto_or_any_combination_of` imported but unused

# supported model configurations
KNOWN_CONF = (
"MOM6",
"CICE6",
"WW3",
"MOM6-WW3",
"MOM6-CICE6",
"CICE6-WW3",
"MOM6-CICE6-WW3",
)

DEFAULT_CONF = ("MOM6", "MOM6-CICE6", "MOM6-CICE6-WW3")

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

variant(
"configurations",
values=auto_or_any_combination_of(
"MOM6",
"CICE6",
"WW3",
"MOM6-WW3",
"MOM6-CICE6",
"CICE6-WW3",
"MOM6-CICE6-WW3",
),
values=any_combination_of(*KNOWN_CONF),
description="ACCESS-OM3 configurations to build",
sticky=True #force concretizer to not pick alternative variants

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

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E261)

packages/access3-exe/package.py:38:20: E261 Insert at least two spaces before an inline comment

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

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E262)

packages/access3-exe/package.py:38:21: E262 Inline comment should start with `# `
)

variant("openmp", default=False, description="Enable OpenMP")

depends_on("cmake@3.18:", type="build")
depends_on("mpi")
depends_on("esmf@8.3.0:")
depends_on("esmf cflags='-fp-model precise' fflags='-fp-model precise'", when="%intel")
depends_on("esmf cflags='-fp-model precise' fflags='-fp-model precise'", when="%oneapi")

for configurations in ["CICE6", "MOM6-CICE6", "MOM6-CICE6-WW3", "CICE6-WW3"]:
depends_on("access-cice+cesmcoupled+access3")
for configurations in ["MOM6", "MOM6-CICE6", "MOM6-CICE6-WW3", "MOM6-WW3"]:
depends_on("access-mom6+cesmcoupled+access3")
# for configurations in ["WW3", "CICE6-WW3", "MOM6-CICE6-WW3", "MOM6-WW3"]:
# depends_on("access-ww3 driver=nuopc/cmeps +cesmcoupled")

flag_handler = CMakePackage.build_system_flags
depends_on("access-cice+access3+cesmcoupled", when="configurations=CICE6")
depends_on("access-cice+access3+cesmcoupled", when="configurations=CICE6-WW3")
depends_on("access-cice+access3+cesmcoupled", when="configurations=MOM6-CICE6")
depends_on("access-cice+access3+cesmcoupled", when="configurations=MOM6-CICE6-WW3")
depends_on("access-cice+access3+cesmcoupled", when="configurations=none")

depends_on("access-mom6+access3+cesmcoupled", when="configurations=MOM6")
depends_on("access-mom6+access3+cesmcoupled", when="configurations=MOM6-CICE6")
depends_on("access-mom6+access3+cesmcoupled", when="configurations=MOM6-WW3")
depends_on("access-mom6+access3+cesmcoupled", when="configurations=MOM6-CICE6-WW3")
depends_on("access-mom6+access3+cesmcoupled", when="configurations=none")

# depends_on("access-ww3+access3+cesmcoupled", when="configurations=WW3")
# depends_on("access-ww3+access3+cesmcoupled", when="configurations=MOM6-WW3")
# depends_on("access-ww3+access3+cesmcoupled", when="configurations=CICE6-WW3")
# depends_on("access-ww3+access3+cesmcoupled", when="configurations=MOM6-CICE6-WW3")
# depends_on("access-ww3+access3+cesmcoupled", when="configurations=none")

def cmake_args(self):

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

args = [
self.define("BuildConfigurations",buildConf)

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

View workflow job for this annotation

GitHub Actions / Check syntax

Ruff (E231)

packages/access3-exe/package.py:76:46: E231 Missing whitespace after ','
]
Expand Down
4 changes: 1 addition & 3 deletions packages/access3-share/package.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Copyright 2013-2025 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -33,8 +33,6 @@ class Access3Share(CMakePackage):
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%intel")
depends_on("parallelio fflags='-qno-opt-dynamic-align -convert big_endian -assume byterecl -ftz -traceback -assume realloc_lhs -fp-model source' cflags='-qno-opt-dynamic-align -fp-model precise -std=gnu99'", when="%oneapi")

flag_handler = CMakePackage.build_system_flags

def cmake_args(self):
args = [
self.define("ACCESS3_LIB_INSTALL", True),
Expand Down

0 comments on commit 2b84afc

Please sign in to comment.