python312Packages.h5py: use environment to spare mpi4py setup.py substitutions (#383649)

This commit is contained in:
Doron Behar
2025-04-17 08:33:03 +03:00
committed by GitHub
@@ -35,20 +35,19 @@ buildPythonPackage rec {
pythonRelaxDeps = [ "mpi4py" ];
# avoid strict pinning of numpy and mpi4py, can't be replaced with
# pythonRelaxDepsHook, see: https://github.com/NixOS/nixpkgs/issues/327941
# Avoid strict pinning of Numpy, can't be replaced with pythonRelaxDepsHook,
# as these are build time dependencies. See:
# https://github.com/NixOS/nixpkgs/issues/327941
postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "numpy >=2.0.0, <3" "numpy"
substituteInPlace setup.py \
--replace-fail "mpi4py ==3.1.4" "mpi4py" \
--replace-fail "mpi4py ==4.0.1" "mpi4py" \
--replace-fail "mpi4py ==3.1.6" "mpi4py"
'';
env = {
HDF5_DIR = "${hdf5}";
HDF5_MPI = if mpiSupport then "ON" else "OFF";
# See discussion at https://github.com/h5py/h5py/issues/2560
H5PY_SETUP_REQUIRES = 0;
};
postConfigure = ''