2022-11-27 09:42:12 +00:00
|
|
|
{ lib
|
|
|
|
, fetchPypi
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
2023-08-22 20:05:09 +00:00
|
|
|
, oldest-supported-numpy
|
2022-11-27 09:42:12 +00:00
|
|
|
, setuptools
|
2023-08-22 20:05:09 +00:00
|
|
|
, wheel
|
2022-11-27 09:42:12 +00:00
|
|
|
, numpy
|
|
|
|
, hdf5
|
|
|
|
, cython
|
|
|
|
, pkgconfig
|
|
|
|
, mpi4py ? null
|
|
|
|
, openssh
|
|
|
|
, pytestCheckHook
|
|
|
|
, cached-property
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi;
|
|
|
|
|
|
|
|
let
|
|
|
|
mpi = hdf5.mpi;
|
|
|
|
mpiSupport = hdf5.mpiSupport;
|
|
|
|
in buildPythonPackage rec {
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "3.9.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "h5py";
|
2022-11-27 09:42:12 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-5gTbZSHB42fGvX+tI5yEf1PMRmRvLSZRNy0Frl6V+Bc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
# avoid strict pinning of numpy
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2022-02-10 20:34:41 +00:00
|
|
|
--replace "mpi4py ==" "mpi4py >="
|
2020-12-07 07:45:13 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
HDF5_DIR = "${hdf5}";
|
|
|
|
HDF5_MPI = if mpiSupport then "ON" else "OFF";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
postConfigure = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# Needed to run the tests reliably. See:
|
|
|
|
# https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30
|
2021-02-05 17:12:51 +00:00
|
|
|
${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
preBuild = lib.optionalString mpiSupport "export CC=${mpi}/bin/mpicc";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cython
|
2023-08-22 20:05:09 +00:00
|
|
|
oldest-supported-numpy
|
2022-11-27 09:42:12 +00:00
|
|
|
pkgconfig
|
|
|
|
setuptools
|
2023-08-22 20:05:09 +00:00
|
|
|
wheel
|
2022-11-27 09:42:12 +00:00
|
|
|
];
|
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
buildInputs = [ hdf5 ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optional mpiSupport mpi;
|
2022-11-27 09:42:12 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ numpy ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optionals mpiSupport [ mpi4py openssh ]
|
|
|
|
++ lib.optionals (pythonOlder "3.8") [ cached-property ];
|
2020-12-07 07:45:13 +00:00
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
# tests now require pytest-mpi, which isn't available and difficult to package
|
|
|
|
doCheck = false;
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook openssh ];
|
2022-11-27 09:42:12 +00:00
|
|
|
|
2020-12-07 07:45:13 +00:00
|
|
|
pythonImportsCheck = [ "h5py" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2023-03-04 12:14:45 +00:00
|
|
|
changelog = "https://github.com/h5py/h5py/blob/${version}/docs/whatsnew/${lib.versions.majorMinor version}.rst";
|
2021-02-05 17:12:51 +00:00
|
|
|
description = "Pythonic interface to the HDF5 binary data format";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.h5py.org/";
|
2021-04-12 18:23:04 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|