Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 version = "2.7.1";
15 pname = "h5py";
16 name = "${pname}-${version}";
17
18 src = fetchurl {
19 url = "mirror://pypi/h/h5py/${name}.tar.gz";
20 sha256 = "180a688311e826ff6ae6d3bda9b5c292b90b28787525ddfcb10a29d5ddcae2cc";
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}