at 18.03-beta 1.5 kB view raw
1{ stdenv, fetchPypi, fetchpatch, python, buildPythonPackage 2, numpy, hdf5, cython, six, pkgconfig 3, mpi4py ? null, openssh }: 4 5assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi; 6 7with stdenv.lib; 8 9let 10 mpi = hdf5.mpi; 11 mpiSupport = hdf5.mpiSupport; 12in buildPythonPackage rec { 13 version = "2.7.1"; 14 pname = "h5py"; 15 16 src = fetchPypi { 17 inherit pname version; 18 sha256 = "180a688311e826ff6ae6d3bda9b5c292b90b28787525ddfcb10a29d5ddcae2cc"; 19 }; 20 21 configure_flags = "--hdf5=${hdf5}" + optionalString mpiSupport " --mpi"; 22 23 postConfigure = '' 24 ${python.executable} setup.py configure ${configure_flags} 25 26 # Needed to run the tests reliably. See: 27 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 28 ${optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} 29 ''; 30 31 preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; 32 33 nativeBuildInputs = [ pkgconfig ]; 34 buildInputs = [ hdf5 cython ] 35 ++ optional mpiSupport mpi; 36 propagatedBuildInputs = [ numpy six] 37 ++ optionals mpiSupport [ mpi4py openssh ]; 38 39 patches = [ 40 # Patch is based on upstream patch. The tox.ini hunk had to be removed. 41 # https://github.com/h5py/h5py/commit/5009e062a6f7d4e074cab0fcb42a780ac2b1d7d4.patch 42 ./numpy-1.14.patch 43 ]; 44 45 meta = { 46 description = 47 "Pythonic interface to the HDF5 binary data format"; 48 homepage = http://www.h5py.org/; 49 license = stdenv.lib.licenses.bsd2; 50 }; 51}