commit:     0ff0d94b073f752de913a0ff24cc4f2aa407f156
Author:     Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Sun Dec 10 15:33:05 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 05:44:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ff0d94b

dev-python/mpi4py: add 3.1.5

Adds python3.12 support

Closes: https://bugs.gentoo.org/882399
Closes: https://bugs.gentoo.org/909923
Closes: https://bugs.gentoo.org/921654
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/34214
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/mpi4py/Manifest                         |  1 +
 .../mpi4py-3.1.5-test_memory.testReadOnly.patch    | 33 ++++++++++
 dev-python/mpi4py/mpi4py-3.1.5.ebuild              | 70 ++++++++++++++++++++++
 3 files changed, 104 insertions(+)

diff --git a/dev-python/mpi4py/Manifest b/dev-python/mpi4py/Manifest
index b98e7a506457..94297609a46f 100644
--- a/dev-python/mpi4py/Manifest
+++ b/dev-python/mpi4py/Manifest
@@ -1 +1,2 @@
 DIST mpi4py-3.1.4.tar.gz 2493282 BLAKE2B 
e1a048e6053263f6685c549e2e6f96072b7d95db68595c8848d0ecdb0a6cadf2b102e4c4ce589053ed17a090335afc56f4b3630b60944aeac7e4bc4ad82d4a1b
 SHA512 
f59ad765bc272f8b63f74cfde4e588f640c4fc3d47d05729509da45a2155f830c1d409ec716ff374756748fa8ebfa6e72f9fbe188a6b89ea3fa115740a532b08
+DIST mpi4py-3.1.5.tar.gz 2469777 BLAKE2B 
0638e3def52f731b64e2999f83f2d6ccc94dc2f8b37d964c10e49ca12470d3d3ef77ff2737294d85614b2d59d1eec49880e74f2ba3d73fd090152b63c8cc701e
 SHA512 
04da1d6daf66cc86fa3ec574eea6e01749f895035e3394afbc68d6245394c5b03557ede0bda3642b06d9c6ff2c1e6e878a6c8c30d3fa3491392e2e13b82cdec8

diff --git 
a/dev-python/mpi4py/files/mpi4py-3.1.5-test_memory.testReadOnly.patch 
b/dev-python/mpi4py/files/mpi4py-3.1.5-test_memory.testReadOnly.patch
new file mode 100644
index 000000000000..986e565588a0
--- /dev/null
+++ b/dev-python/mpi4py/files/mpi4py-3.1.5-test_memory.testReadOnly.patch
@@ -0,0 +1,33 @@
+https://github.com/mpi4py/mpi4py/pull/452
+From: Paul Zander <negril.nx+gen...@gmail.com>
+
+From 3adbd69b7219525f32636552394935a0a770896d Mon Sep 17 00:00:00 2001
+From: Lisandro Dalcin <dalc...@gmail.com>
+Date: Mon, 15 Jan 2024 10:45:38 +0300
+Subject: [PATCH] fix: Fix implementation of MPI.buffer.toreadonly()
+
+---
+ src/mpi4py/MPI/asbuffer.pxi | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/mpi4py/MPI/asbuffer.pxi b/src/mpi4py/MPI/asbuffer.pxi
+index 15e06a1..6536c1f 100644
+--- a/src/mpi4py/MPI/asbuffer.pxi
++++ b/src/mpi4py/MPI/asbuffer.pxi
+@@ -257,14 +257,12 @@ cdef class memory:
+ 
+     def toreadonly(self) -> memory:
+         """Return a readonly version of the memory object"""
+-        cdef void *buf = self.view.buf
+-        cdef Py_ssize_t size = self.view.len
+         cdef object obj = self
+         if self.view.obj != NULL:
+             obj = <object>self.view.obj
+         cdef memory mem = memory.__new__(memory)
+-        PyBuffer_FillInfo(&mem.view, obj,
+-                          buf, size, 1, PyBUF_SIMPLE)
++        PyMPI_GetBuffer(obj, &mem.view, PyBUF_SIMPLE)
++        mem.view.readonly = 1
+         return mem
+ 
+     def release(self) -> None:

diff --git a/dev-python/mpi4py/mpi4py-3.1.5.ebuild 
b/dev-python/mpi4py/mpi4py-3.1.5.ebuild
new file mode 100644
index 000000000000..b0a4789dda26
--- /dev/null
+++ b/dev-python/mpi4py/mpi4py-3.1.5.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+inherit distutils-r1 pypi
+
+DESCRIPTION="Message Passing Interface for Python"
+HOMEPAGE="https://github.com/mpi4py/mpi4py https://pypi.org/project/mpi4py/";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc examples test"
+
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-python/cython[${PYTHON_USEDEP}]
+       dev-python/numpy[${PYTHON_USEDEP}]
+       virtual/mpi
+"
+DEPEND="${RDEPEND}
+       test? (
+               virtual/mpi[romio]
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.1.5-test_memory.testReadOnly.patch"
+)
+
+python_prepare_all() {
+       # not needed on install
+       rm -vr docs/source || die
+       rm test/test_pickle.py || die # disabled by Gentoo-bug #659348
+       distutils-r1_python_prepare_all
+}
+
+python_test() {
+       echo "Beginning test phase"
+       local -x PYTHONPATH="${BUILD_DIR}/install$(python_get_sitedir)"
+
+       # python want's all arguments as separate strings
+       local mpi_opts=(
+               "-n" "1"
+       )
+       # spawn is not stable in OpenMPI 4
+       # https://github.com/jsquyres/ompi/pull/4#issuecomment-806897758
+       # oob_tcp_if_include lo is needed to allow test in systemd-nspawn 
container
+       has_version sys-cluster/openmpi && mpi_opts+=(
+               "--use-hwthread-cpus"
+               "--mca" "btl" "tcp,self"
+               "--mca" "oob_tcp_if_include" "lo"
+       )
+       mpiexec \
+               "${mpi_opts[@]}" \
+               "${PYTHON}" -B -v ./test/runtests.py -v \
+               --exclude="test_msgspec" --exclude="test_spawn" ||
+               die "Testsuite failed under ${EPYTHON}"
+}
+
+python_install_all() {
+       use doc && local HTML_DOCS=( docs/. )
+       use examples && local DOCS=( demo )
+       distutils-r1_python_install_all
+}

Reply via email to