1 { lib, fetchPypi, isPy27, python, buildPythonPackage, pythonOlder
2 , numpy, hdf5, cython, six, pkgconfig, unittest2, fetchpatch
3 , mpi4py ? null, openssh, pytestCheckHook, cached-property }:
5 assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi;
9 mpiSupport = hdf5.mpiSupport;
10 in buildPythonPackage rec {
16 inherit pname version;
17 sha256 = "sha256-iUdL6RG/zbNMvw2YuOxItXjCeon9sa5O51E/HvjZJJ4=";
20 # avoid strict pinning of numpy
22 substituteInPlace setup.py \
23 --replace "numpy ==" "numpy >="
27 HDF5_MPI = if mpiSupport then "ON" else "OFF";
30 # Needed to run the tests reliably. See:
31 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30
32 ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"}
35 preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else "";
37 # tests now require pytest-mpi, which isn't available and difficult to package
39 checkInputs = lib.optional isPy27 unittest2 ++ [ pytestCheckHook openssh ];
40 nativeBuildInputs = [ pkgconfig cython ];
41 buildInputs = [ hdf5 ]
42 ++ lib.optional mpiSupport mpi;
43 propagatedBuildInputs = [ numpy six]
44 ++ lib.optionals mpiSupport [ mpi4py openssh ]
45 ++ lib.optionals (pythonOlder "3.8") [ cached-property ];
47 pythonImportsCheck = [ "h5py" ];
50 description = "Pythonic interface to the HDF5 binary data format";
51 homepage = "http://www.h5py.org/";
52 license = licenses.bsd3;