nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 89 lines 2.1 kB view raw
1{ 2 lib, 3 fetchPypi, 4 buildPythonPackage, 5 setuptools, 6 numpy, 7 hdf5, 8 cython, 9 pkgconfig, 10 mpi4py ? null, 11 openssh, 12 pytestCheckHook, 13 pytest-mpi, 14}: 15 16assert hdf5.mpiSupport -> mpi4py != null && hdf5.mpi == mpi4py.mpi; 17 18let 19 mpi = hdf5.mpi; 20 mpiSupport = hdf5.mpiSupport; 21in 22buildPythonPackage rec { 23 version = "3.15.1"; 24 pname = "h5py"; 25 pyproject = true; 26 27 src = fetchPypi { 28 inherit pname version; 29 hash = "sha256-yG4+1FxEc1ZN5VqoO2/J5erYZXh3PfvZMEc4AELia2k="; 30 }; 31 32 pythonRelaxDeps = [ "mpi4py" ]; 33 34 env = { 35 HDF5_DIR = "${hdf5}"; 36 HDF5_MPI = if mpiSupport then "ON" else "OFF"; 37 # See discussion at https://github.com/h5py/h5py/issues/2560 38 H5PY_SETUP_REQUIRES = 0; 39 }; 40 41 postConfigure = '' 42 # Needed to run the tests reliably. See: 43 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 44 ${lib.optionalString mpiSupport "export OMPI_MCA_rmaps_base_oversubscribe=yes"} 45 ''; 46 47 preBuild = lib.optionalString mpiSupport "export CC=${lib.getDev mpi}/bin/mpicc"; 48 49 build-system = [ 50 cython 51 numpy 52 pkgconfig 53 setuptools 54 ]; 55 56 buildInputs = [ hdf5 ] ++ lib.optional mpiSupport mpi; 57 58 dependencies = [ 59 numpy 60 ] 61 ++ lib.optionals mpiSupport [ 62 mpi4py 63 openssh 64 ]; 65 66 nativeCheckInputs = [ 67 pytestCheckHook 68 pytest-mpi 69 openssh 70 ]; 71 # https://github.com/NixOS/nixpkgs/issues/255262 72 preCheck = '' 73 cd $out 74 ''; 75 # For some reason these fail when mpi support is enabled, due to concurrent 76 # writings. There are a few open issues about this in the bug tracker, but 77 # not related to the tests. 78 disabledTests = lib.optionals mpiSupport [ "TestPageBuffering" ]; 79 80 pythonImportsCheck = [ "h5py" ]; 81 82 meta = { 83 changelog = "https://github.com/h5py/h5py/blob/${version}/docs/whatsnew/${lib.versions.majorMinor version}.rst"; 84 description = "Pythonic interface to the HDF5 binary data format"; 85 homepage = "http://www.h5py.org/"; 86 license = lib.licenses.bsd3; 87 maintainers = with lib.maintainers; [ doronbehar ]; 88 }; 89}