From b306e0edf2162536528e417345f2769b2aa48f96 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 15 Jul 2024 13:53:22 +0300 Subject: [PATCH] python312Packages.mpi4py: 3.1.6 -> 3.1.6-unstable-2024-07-08; rewrite --- .../python-modules/mpi4py/default.nix | 83 ++++++++++--------- .../python-modules/mpi4py/tests.patch | 13 --- 2 files changed, 42 insertions(+), 54 deletions(-) delete mode 100644 pkgs/development/python-modules/mpi4py/tests.patch diff --git a/pkgs/development/python-modules/mpi4py/default.nix b/pkgs/development/python-modules/mpi4py/default.nix index 43c4040fba72..1aba82440888 100644 --- a/pkgs/development/python-modules/mpi4py/default.nix +++ b/pkgs/development/python-modules/mpi4py/default.nix @@ -1,61 +1,62 @@ { lib, - fetchPypi, - python, + fetchFromGitHub, buildPythonPackage, + cython, + setuptools, mpi, - mpiCheckPhaseHook, openssh, + pytestCheckHook, + mpiCheckPhaseHook, }: buildPythonPackage rec { pname = "mpi4py"; - version = "3.1.6"; - format = "setuptools"; + # See https://github.com/mpi4py/mpi4py/issues/386 . Part of the changes since + # the last release include Python 3.12 fixes. + version = "3.1.6-unstable-2024-07-08"; + pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-yPpiXg+SsILvlVv7UvGfpmkdKSc9fXETXSlaoUPe5ss="; + src = fetchFromGitHub { + repo = "mpi4py"; + owner = "mpi4py"; + rev = "e9a59719bbce1b9c351e1e30ecd3be3b459e97cd"; + hash = "sha256-C/nidWGr8xsLV73u7HRtnXoQgYmoRJkD45DFrdXXTPI="; }; + build-system = [ + cython + setuptools + mpi + ]; + dependencies = [ + mpi + ]; + + __darwinAllowLocalNetworking = true; + + nativeCheckInputs = [ + pytestCheckHook + openssh + mpiCheckPhaseHook + ]; + # Most tests pass, (besides `test_spawn.py`), but when reaching ~80% tests + # progress, an orted process hangs and the tests don't finish. This issue is + # probably due to the sandbox. + doCheck = false; + disabledTestPaths = [ + # Almost all tests in this file fail (TODO: Report about this upstream..) + "test/test_spawn.py" + ]; + passthru = { inherit mpi; }; - postPatch = '' - substituteInPlace test/test_spawn.py --replace \ - "unittest.skipMPI('openmpi(<3.0.0)')" \ - "unittest.skipMPI('openmpi')" - ''; - - configurePhase = ""; - - installPhase = '' - mkdir -p "$out/${python.sitePackages}" - export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH" - - ${python}/bin/${python.executable} setup.py install \ - --install-lib=$out/${python.sitePackages} \ - --prefix="$out" - - # --install-lib: - # sometimes packages specify where files should be installed outside the usual - # python lib prefix, we override that back so all infrastructure (setup hooks) - # work as expected - ''; - - nativeBuildInputs = [ mpi ]; - - __darwinAllowLocalNetworking = true; - - nativeCheckInputs = [ - openssh - mpiCheckPhaseHook - ]; - - meta = with lib; { + meta = { description = "Python bindings for the Message Passing Interface standard"; homepage = "https://github.com/mpi4py/mpi4py"; - license = licenses.bsd2; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ doronbehar ]; }; } diff --git a/pkgs/development/python-modules/mpi4py/tests.patch b/pkgs/development/python-modules/mpi4py/tests.patch deleted file mode 100644 index 168e3b4b38d3..000000000000 --- a/pkgs/development/python-modules/mpi4py/tests.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git i/test/test_dl.py w/test/test_dl.py -index a3211a3..9d25569 100644 ---- i/test/test_dl.py -+++ w/test/test_dl.py -@@ -12,7 +12,7 @@ class TestDL(unittest.TestCase): - if sys.platform == 'darwin': - libm = 'libm.dylib' - else: -- libm = 'libm.so' -+ libm = 'libm.so.6' - - handle = dl.dlopen(libm, dl.RTLD_LOCAL|dl.RTLD_LAZY) - self.assertTrue(handle != 0)