commit:     b8b09e7454bd679d7ac0ba3f18c693b41dd8e25f
Author:     Alex Fan <alex.fan.q <AT> gmail <DOT> com>
AuthorDate: Sun Sep  1 09:02:52 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 27 22:52:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8b09e74

dev-python/mpi4py: add 4.0.0

use meson-python as builder backend.
don't force mpi[romio] and remove all excludes since those tests are
skipped by upstream already

Closes: https://bugs.gentoo.org/743448
Signed-off-by: Alex Fan <alex.fan.q <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/mpi4py/Manifest                         |  1 +
 dev-python/mpi4py/files/mpi4py-4-use-mesonpy.patch | 11 +++
 dev-python/mpi4py/metadata.xml                     |  3 +-
 dev-python/mpi4py/mpi4py-4.0.0.ebuild              | 79 ++++++++++++++++++++++
 4 files changed, 93 insertions(+), 1 deletion(-)

diff --git a/dev-python/mpi4py/Manifest b/dev-python/mpi4py/Manifest
index 19f3f4338db2..a49ad9d77f1f 100644
--- a/dev-python/mpi4py/Manifest
+++ b/dev-python/mpi4py/Manifest
@@ -1 +1,2 @@
 DIST mpi4py-3.1.5.tar.gz 2469777 BLAKE2B 
0638e3def52f731b64e2999f83f2d6ccc94dc2f8b37d964c10e49ca12470d3d3ef77ff2737294d85614b2d59d1eec49880e74f2ba3d73fd090152b63c8cc701e
 SHA512 
04da1d6daf66cc86fa3ec574eea6e01749f895035e3394afbc68d6245394c5b03557ede0bda3642b06d9c6ff2c1e6e878a6c8c30d3fa3491392e2e13b82cdec8
+DIST mpi4py-4.0.0.tar.gz 464833 BLAKE2B 
86073c1ab0ff65dd38808390fa95056ac7dfd5f0802aff3d43313a83f07351ab83b97cb7d553fb4fa5133491971c5526246a10081a05bd9aaa6ff5669b214d1d
 SHA512 
a90d82b976cb112d60fef8a53480a0ea977a2aca32e69f9869081f34ae0f0d4a6674340a534d501fad313c12ba593d2f34afa15d0a07e3baacb49483851644ae

diff --git a/dev-python/mpi4py/files/mpi4py-4-use-mesonpy.patch 
b/dev-python/mpi4py/files/mpi4py-4-use-mesonpy.patch
new file mode 100644
index 000000000000..f8ba9bd474f5
--- /dev/null
+++ b/dev-python/mpi4py/files/mpi4py-4-use-mesonpy.patch
@@ -0,0 +1,11 @@
+diff --git a/pyproject.toml b/pyproject.toml
+index 8585f6d..5b0b2d8 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,4 +1,3 @@
+ [build-system]
+-requires = ["setuptools >= 42", "build"]
+-build-backend = "builder"
+-backend-path = ["conf"]
++requires = ["meson-python", "Cython"]
++build-backend = "mesonpy"

diff --git a/dev-python/mpi4py/metadata.xml b/dev-python/mpi4py/metadata.xml
index 0dd4ceca2177..11c562b3c581 100644
--- a/dev-python/mpi4py/metadata.xml
+++ b/dev-python/mpi4py/metadata.xml
@@ -9,7 +9,8 @@
     <email>[email protected]</email>
     <name>Proxy Maintainers</name>
   </maintainer>
-  <longdescription lang="en">MPI for Python (mpi4py) provides bindings of the 
Message Passing
+  <longdescription lang="en">
+  MPI for Python (mpi4py) provides bindings of the Message Passing
   Interface (MPI) standard for the Python programming language,
   allowing any Python program to exploit multiple processors.
   This package is constructed on top of the MPI-1/MPI-2 specification

diff --git a/dev-python/mpi4py/mpi4py-4.0.0.ebuild 
b/dev-python/mpi4py/mpi4py-4.0.0.ebuild
new file mode 100644
index 000000000000..a92ac5a8fced
--- /dev/null
+++ b/dev-python/mpi4py/mpi4py-4.0.0.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=meson-python
+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"
+
+RDEPEND="
+       dev-python/numpy[${PYTHON_USEDEP}]
+       virtual/mpi
+"
+DEPEND="${RDEPEND}"
+
+BDEPEND="
+       dev-python/cython[${PYTHON_USEDEP}]
+       >=dev-build/meson-1.0.0
+       virtual/mpi
+"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-4-use-mesonpy.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_compile() {
+       export CC=mpicc
+       distutils-r1_python_compile
+}
+
+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"
+       )
+       if has_version sys-cluster/openmpi; then
+               local mpi_opts+=(
+                       "--use-hwthread-cpus"
+                       # allow test in systemd-nspawn container
+                       "--mca" "btl" "tcp,self"
+                       "--mca" "oob_tcp_if_include" "lo"
+                       # disable openmpi OSC UCX component
+                       # https://github.com/open-mpi/ompi/issues/12517
+                       "--mca" "osc" "^ucx"
+               )
+       fi
+       mpiexec \
+               "${mpi_opts[@]}" \
+               "${PYTHON}" -B -v ./test/runtests.py -v ||
+               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