at 24.05-pre 1.9 kB view raw
1{ lib 2, fetchPypi 3, buildPythonPackage 4, pythonOlder 5, oldest-supported-numpy 6, setuptools 7, wheel 8, numpy 9, hdf5 10, cython 11, pkgconfig 12, mpi4py ? null 13, openssh 14, pytestCheckHook 15, cached-property 16}: 17 18assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi; 19 20let 21 mpi = hdf5.mpi; 22 mpiSupport = hdf5.mpiSupport; 23in buildPythonPackage rec { 24 version = "3.9.0"; 25 pname = "h5py"; 26 format = "pyproject"; 27 28 disabled = pythonOlder "3.7"; 29 30 src = fetchPypi { 31 inherit pname version; 32 hash = "sha256-5gTbZSHB42fGvX+tI5yEf1PMRmRvLSZRNy0Frl6V+Bc="; 33 }; 34 35 # avoid strict pinning of numpy 36 postPatch = '' 37 substituteInPlace setup.py \ 38 --replace "mpi4py ==" "mpi4py >=" 39 ''; 40 41 HDF5_DIR = "${hdf5}"; 42 HDF5_MPI = if mpiSupport then "ON" else "OFF"; 43 44 postConfigure = '' 45 # Needed to run the tests reliably. See: 46 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 47 ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} 48 ''; 49 50 preBuild = lib.optionalString mpiSupport "export CC=${mpi}/bin/mpicc"; 51 52 nativeBuildInputs = [ 53 cython 54 oldest-supported-numpy 55 pkgconfig 56 setuptools 57 wheel 58 ]; 59 60 buildInputs = [ hdf5 ] 61 ++ lib.optional mpiSupport mpi; 62 63 propagatedBuildInputs = [ numpy ] 64 ++ lib.optionals mpiSupport [ mpi4py openssh ] 65 ++ lib.optionals (pythonOlder "3.8") [ cached-property ]; 66 67 # tests now require pytest-mpi, which isn't available and difficult to package 68 doCheck = false; 69 nativeCheckInputs = [ pytestCheckHook openssh ]; 70 71 pythonImportsCheck = [ "h5py" ]; 72 73 meta = with lib; { 74 changelog = "https://github.com/h5py/h5py/blob/${version}/docs/whatsnew/${lib.versions.majorMinor version}.rst"; 75 description = "Pythonic interface to the HDF5 binary data format"; 76 homepage = "http://www.h5py.org/"; 77 license = licenses.bsd3; 78 maintainers = [ ]; 79 }; 80}