linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / python-modules / mpi4py / default.nix
blob6e8fd896d913c562761dec95aa2ae1d486b8c5d4
1 { lib, fetchPypi, fetchpatch, python, buildPythonPackage, mpi, openssh }:
3 buildPythonPackage rec {
4   pname = "mpi4py";
5   version = "3.0.3";
7   src = fetchPypi {
8     inherit pname version;
9     sha256 = "012d716c8b9ed1e513fcc4b18e5af16a8791f51e6d1716baccf988ad355c5a1f";
10   };
12   patches = [ (fetchpatch {
13     name = "disable-broken-test"; # upstream patch
14     url = "https://github.com/mpi4py/mpi4py/commit/e13cc3ee59ec6ec2c6ee20e384e1e649d5027e8a.patch";
15     sha256 = "0iwknrhxnfmsqjj8ahpn50c8pcdyv9p3wmcqi1jhr4i5y7lnmvvx";
16   })];
18   passthru = {
19     inherit mpi;
20   };
22   postPatch = ''
23     substituteInPlace test/test_spawn.py --replace \
24                       "unittest.skipMPI('openmpi(<3.0.0)')" \
25                       "unittest.skipMPI('openmpi')"
26   '';
28   configurePhase = "";
30   installPhase = ''
31     mkdir -p "$out/lib/${python.libPrefix}/site-packages"
32     export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
34     ${python}/bin/${python.executable} setup.py install \
35       --install-lib=$out/lib/${python.libPrefix}/site-packages \
36       --prefix="$out"
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
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   '';
48   setupPyBuildFlags = ["--mpicc=${mpi}/bin/mpicc"];
50   nativeBuildInputs = [ mpi openssh ];
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   };