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