commit:     22242611fbd98c3f48b1a78bbac102dd8e310c10
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 31 19:09:41 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 19:19:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=22242611

dev-python/numpy: Backport setuptools-74 fixes to 2.0.2-r1

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../numpy/files/numpy-2.0.2-setuptools-74.patch    | 29 ++++++++++++++++++++++
 .../{numpy-2.0.2.ebuild => numpy-2.0.2-r1.ebuild}  | 12 +++++++++
 2 files changed, 41 insertions(+)

diff --git a/dev-python/numpy/files/numpy-2.0.2-setuptools-74.patch 
b/dev-python/numpy/files/numpy-2.0.2-setuptools-74.patch
new file mode 100644
index 000000000000..7e61378bdecc
--- /dev/null
+++ b/dev-python/numpy/files/numpy-2.0.2-setuptools-74.patch
@@ -0,0 +1,29 @@
+From 1cc02cc6710384c52e1082a33d1617504eaed296 Mon Sep 17 00:00:00 2001
+From: Katie Rust <[email protected]>
+Date: Mon, 16 Sep 2024 13:04:22 -0500
+Subject: [PATCH] BUG: Stub out `get_build_msvc_version` if
+ `distutils.msvccompiler` cannot be imported (fixes #27405)
+
+---
+ numpy/distutils/mingw32ccompiler.py | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/numpy/distutils/mingw32ccompiler.py 
b/numpy/distutils/mingw32ccompiler.py
+index 39905a784088..2599a9e9a807 100644
+--- a/numpy/distutils/mingw32ccompiler.py
++++ b/numpy/distutils/mingw32ccompiler.py
+@@ -24,7 +24,13 @@
+ 
+ import distutils.cygwinccompiler
+ from distutils.unixccompiler import UnixCCompiler
+-from distutils.msvccompiler import get_build_version as get_build_msvc_version
++
++try:
++    from distutils.msvccompiler import get_build_version as 
get_build_msvc_version
++except ImportError:
++    def get_build_msvc_version():
++        return None
++
+ from distutils.errors import UnknownFileError
+ from numpy.distutils.misc_util import (msvc_runtime_library,
+                                        msvc_runtime_version,

diff --git a/dev-python/numpy/numpy-2.0.2.ebuild 
b/dev-python/numpy/numpy-2.0.2-r1.ebuild
similarity index 92%
rename from dev-python/numpy/numpy-2.0.2.ebuild
rename to dev-python/numpy/numpy-2.0.2-r1.ebuild
index 36b49c01956b..b2f86a093db9 100644
--- a/dev-python/numpy/numpy-2.0.2.ebuild
+++ b/dev-python/numpy/numpy-2.0.2-r1.ebuild
@@ -57,6 +57,11 @@ EPYTEST_XDIST=1
 distutils_enable_tests pytest
 
 python_prepare_all() {
+       local PATCHES=(
+               # https://github.com/numpy/numpy/pull/27406
+               "${FILESDIR}/${P}-setuptools-74.patch"
+       )
+
        # bug #922457
        filter-lto
        # https://github.com/numpy/numpy/issues/25004
@@ -119,6 +124,13 @@ python_test() {
                        ;;
        esac
 
+       if has_version ">=dev-python/setuptools-74[${PYTHON_USEDEP}]"; then
+               # msvccompiler removal
+               EPYTEST_DESELECT+=(
+                       tests/test_public_api.py::test_api_importable
+               )
+       fi
+
        if ! has_version -b "~${CATEGORY}/${P}[${PYTHON_USEDEP}]" ; then
                # depends on importing numpy.random from system namespace
                EPYTEST_DESELECT+=(

Reply via email to