nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 51 lines 1.5 kB view raw
1{ lib, fetchPypi, fetchpatch, python, buildPythonPackage, mpi, openssh }: 2 3buildPythonPackage rec { 4 pname = "mpi4py"; 5 version = "3.1.3"; 6 7 src = fetchPypi { 8 inherit pname version; 9 sha256 = "sha256-8en64QefQ+r92fgXzbP9MNcJ7cCTtdXa2lekYbLbMAg="; 10 }; 11 12 passthru = { 13 inherit mpi; 14 }; 15 16 postPatch = '' 17 substituteInPlace test/test_spawn.py --replace \ 18 "unittest.skipMPI('openmpi(<3.0.0)')" \ 19 "unittest.skipMPI('openmpi')" 20 ''; 21 22 configurePhase = ""; 23 24 installPhase = '' 25 mkdir -p "$out/lib/${python.libPrefix}/site-packages" 26 export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" 27 28 ${python}/bin/${python.executable} setup.py install \ 29 --install-lib=$out/lib/${python.libPrefix}/site-packages \ 30 --prefix="$out" 31 32 # --install-lib: 33 # sometimes packages specify where files should be installed outside the usual 34 # python lib prefix, we override that back so all infrastructure (setup hooks) 35 # work as expected 36 37 # Needed to run the tests reliably. See: 38 # https://bitbucket.org/mpi4py/mpi4py/issues/87/multiple-test-errors-with-openmpi-30 39 export OMPI_MCA_rmaps_base_oversubscribe=yes 40 ''; 41 42 setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"]; 43 44 nativeBuildInputs = [ mpi openssh ]; 45 46 meta = with lib; { 47 description = "Python bindings for the Message Passing Interface standard"; 48 homepage = "https://bitbucket.org/mpi4py/mpi4py/"; 49 license = licenses.bsd3; 50 }; 51}