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