python3Packages.mpi4py: fix build on darwin

Co-authored-by: Doron Behar <doron.behar@gmail.com>
This commit is contained in:
Moraxyc
2026-08-08 20:50:58 +08:00
parent 5e4b0325a8
commit cd2b1d5ffd

View File

@@ -4,6 +4,7 @@
fetchFromGitHub,
cython,
setuptools,
stdenv,
mpi,
toPythonModule,
pytest,
@@ -52,6 +53,13 @@ buildPythonPackage rec {
# see https://github.com/mpi4py/mpi4py/issues/545#issuecomment-2343011460
env.MPI4PY_TEST_SPAWN = if mpi.pname == "openmpi" then 0 else 1;
disabledTests = [
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# testJoin calls socket.getaddrinfo(socket.gethostname(), ...)
"test_dynproc.TestDPM.testJoin"
];
# follow upstream's checkPhase
# see https://github.com/mpi4py/mpi4py/blob/4.1.0/.github/workflows/ci-test.yml#L92-L95
checkPhase = ''
@@ -60,7 +68,9 @@ buildPythonPackage rec {
echo 'Testing mpi4py (np=1)'
mpiexec -n 1 python test/main.py -v
echo 'Testing mpi4py (np=2)'
mpiexec -n 2 python test/main.py -v -f -e spawn
mpiexec -n 2 python test/main.py -v -f -e spawn${
lib.concatMapStrings (test: " -x ${test}") disabledTests
}
runHook postCheck
'';