Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 19.03 1.3 kB view raw
1{ stdenv, fetchPypi, isPy27, python, buildPythonPackage 2, numpy, hdf5, cython, six, pkgconfig, unittest2 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.9.0"; 14 pname = "h5py"; 15 16 src = fetchPypi { 17 inherit pname version; 18 sha256 = "9d41ca62daf36d6b6515ab8765e4c8c4388ee18e2a665701fef2b41563821002"; 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 checkInputs = optional isPy27 unittest2; 34 nativeBuildInputs = [ pkgconfig ]; 35 buildInputs = [ hdf5 cython ] 36 ++ optional mpiSupport mpi; 37 propagatedBuildInputs = [ numpy six] 38 ++ optionals mpiSupport [ mpi4py openssh ]; 39 40 meta = { 41 description = 42 "Pythonic interface to the HDF5 binary data format"; 43 homepage = http://www.h5py.org/; 44 license = stdenv.lib.licenses.bsd2; 45 }; 46}