summary refs log tree commit diff
path: root/pkgs/development/python-modules/h5py/default.nix
blob: 39a35ad49c6e645afc00ea299ed572bac307e4da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ stdenv, fetchurl, python, buildPythonPackage
, numpy, hdf5, cython
, mpiSupport ? false, mpi4py ? null, mpi ? null }:

assert mpiSupport == hdf5.mpiSupport;
assert mpiSupport -> mpi != null
  && mpi4py != null
  && mpi == mpi4py.mpi
  && mpi == hdf5.mpi
  ;

with stdenv.lib;

buildPythonPackage rec {
  name = "h5py-2.3.1";

  src = fetchurl {
    url = "https://pypi.python.org/packages/source/h/h5py/${name}.tar.gz";
    md5 = "8f32f96d653e904d20f9f910c6d9dd91";
  };

  setupPyBuildFlags = [ "--hdf5=${hdf5}" ]
    ++ optional mpiSupport "--mpi"
    ;
  setupPyInstallFlags = setupPyBuildFlags;

  preBuild = if mpiSupport then "export CC=${mpi}/bin/mpicc" else "";

  buildInputs = [ hdf5 cython ]
    ++ optional mpiSupport mpi
    ;
  propagatedBuildInputs = [ numpy ]
    ++ optional mpiSupport mpi4py
    ;

  meta = {
    description =
      "Pythonic interface to the HDF5 binary data format";
    homepage = "http://www.h5py.org/";
    license = stdenv.lib.licenses.bsd2;
  };
}