Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patch for py-netcdf4 so that we can build it ~mpi #502

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions var/spack/repos/builtin/packages/py-netcdf4/nompi.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/setup.py
+++ b/setup.py
@@ -392,7 +392,8 @@ if 'sdist' not in sys.argv[1:] and 'clean' not in sys.argv[1:] and '--version' n
(netcdf_lib_version > "4.4" and netcdf_lib_version < "4.5"):
has_cdf5_format = True

- has_parallel_support = check_has_parallel_support(inc_dirs)
+ #has_parallel_support = check_has_parallel_support(inc_dirs)
+ has_parallel_support = False
has_has_not = "has" if has_parallel_support else "does not have"
print(f"netcdf lib {has_has_not} parallel functions")
10 changes: 8 additions & 2 deletions var/spack/repos/builtin/packages/py-netcdf4/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ class PyNetcdf4(PythonPackage):
# https://github.com/Unidata/netcdf4-python/pull/1317
depends_on("py-numpy@:1", when="@:1.6", type=("build", "link", "run"))
depends_on("py-mpi4py", when="+mpi", type=("build", "run"))
depends_on("netcdf-c", when="-mpi")
depends_on("netcdf-c", when="~mpi")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would take out the when="~mpi" but functionally I don't think it matters.

depends_on("netcdf-c+mpi", when="+mpi")
depends_on("[email protected]:+hl", when="-mpi")
depends_on("[email protected]:+hl", when="~mpi")
depends_on("[email protected]:+hl+mpi", when="+mpi")

# The installation script tries to find hdf5 using pkg-config. However, the
Expand All @@ -54,6 +54,12 @@ class PyNetcdf4(PythonPackage):
# following patch disables the usage of pkg-config at all.
patch("disable_pkgconf.patch")

# Allow building py-netcdf4 ~mpi when netCDF was build with +mpi. This patch
# overrides the auto-decect feature (has_parallel_support) in setup.py. The
# logic in setup.py changed between 1.6.5 and 1.7.1, therefore this patch
# only works for versions 1.7.1 and later.
patch("nompi.patch", when="@1.7.1: ~mpi")

# https://github.com/Unidata/netcdf4-python/pull/1322
patch(
"https://github.com/Unidata/netcdf4-python/commit/49dcd0b5bd25824c254770c0d41445133fc13a46.patch?full_index=1",
Expand Down
Loading