1{
2 lib,
3 fetchPypi,
4 fetchpatch,
5 python,
6 buildPythonPackage,
7 mpi,
8 mpiCheckPhaseHook,
9 openssh,
10}:
11
12buildPythonPackage rec {
13 pname = "mpi4py";
14 version = "3.1.6";
15 format = "setuptools";
16
17 src = fetchPypi {
18 inherit pname version;
19 hash = "sha256-yPpiXg+SsILvlVv7UvGfpmkdKSc9fXETXSlaoUPe5ss=";
20 };
21
22 passthru = {
23 inherit mpi;
24 };
25
26 postPatch = ''
27 substituteInPlace test/test_spawn.py --replace \
28 "unittest.skipMPI('openmpi(<3.0.0)')" \
29 "unittest.skipMPI('openmpi')"
30 '';
31
32 configurePhase = "";
33
34 installPhase = ''
35 mkdir -p "$out/${python.sitePackages}"
36 export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
37
38 ${python}/bin/${python.executable} setup.py install \
39 --install-lib=$out/${python.sitePackages} \
40 --prefix="$out"
41
42 # --install-lib:
43 # sometimes packages specify where files should be installed outside the usual
44 # python lib prefix, we override that back so all infrastructure (setup hooks)
45 # work as expected
46 '';
47
48 nativeBuildInputs = [ mpi ];
49
50 __darwinAllowLocalNetworking = true;
51
52 nativeCheckInputs = [
53 openssh
54 mpiCheckPhaseHook
55 ];
56
57 meta = with lib; {
58 description = "Python bindings for the Message Passing Interface standard";
59 homepage = "https://github.com/mpi4py/mpi4py";
60 license = licenses.bsd2;
61 };
62}