1{ stdenv, fetchurl, python, buildPythonPackage 2, numpy, hdf5, cython, six, pkgconfig 3, mpiSupport ? false, mpi4py ? null, mpi ? null }: 4 5assert mpiSupport == hdf5.mpiSupport; 6assert mpiSupport -> mpi != null 7 && mpi4py != null 8 && mpi == mpi4py.mpi 9 && mpi == hdf5.mpi 10 ; 11 12with stdenv.lib; 13 14buildPythonPackage rec { 15 name = "h5py-${version}"; 16 version = "2.5.0"; 17 18 src = fetchurl { 19 url = "https://pypi.python.org/packages/source/h/h5py/${name}.tar.gz"; 20 sha256 = "9833df8a679e108b561670b245bcf9f3a827b10ccb3a5fa1341523852cfac2f6"; 21 }; 22 23 configure_flags = "--hdf5=${hdf5}" + optionalString mpiSupport " --mpi"; 24 25 postConfigure = '' 26 ${python.executable} setup.py configure ${configure_flags} 27 ''; 28 29 preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else ""; 30 31 buildInputs = [ hdf5 cython pkgconfig ] 32 ++ optional mpiSupport mpi 33 ; 34 propagatedBuildInputs = [ numpy six] 35 ++ optional mpiSupport mpi4py 36 ; 37 38 meta = { 39 description = 40 "Pythonic interface to the HDF5 binary data format"; 41 homepage = "http://www.h5py.org/"; 42 license = stdenv.lib.licenses.bsd2; 43 }; 44}