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