- Add patch fix-meson-multiple-python-versions.patch:

* Ensure meson executes sys.executable when testing Cython.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numpy?expand=0&rev=157
This commit is contained in:
Steve Kowalik 2024-04-23 12:52:48 +00:00 committed by Git OBS Bridge
parent ad4bf88387
commit 33a6f574a9
3 changed files with 62 additions and 2 deletions

View File

@ -0,0 +1,53 @@
From 59694be29a71b17ad1ce58c865a5524c50bfedee Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Fri, 16 Feb 2024 22:18:43 +0100
Subject: [PATCH] TST: fix Cython compile test which invokes `meson`
Closes gh-24956
[skip circle]
---
numpy/core/tests/test_cython.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
Index: numpy-1.26.4/numpy/core/tests/test_cython.py
===================================================================
--- numpy-1.26.4.orig/numpy/core/tests/test_cython.py
+++ numpy-1.26.4/numpy/core/tests/test_cython.py
@@ -37,6 +37,13 @@ def install_temp(tmpdir_factory):
srcdir = os.path.join(os.path.dirname(__file__), 'examples', 'cython')
build_dir = tmpdir_factory.mktemp("cython_test") / "build"
os.makedirs(build_dir, exist_ok=True)
+ # Ensure we use the correct Python interpreter even when `meson` is
+ # installed in a different Python environment (see gh-24956)
+ native_file = str(build_dir / 'interpreter-native-file.ini')
+ with open(native_file, 'w') as f:
+ f.write("[binaries]\n")
+ f.write(f"python = '{sys.executable}'")
+
try:
subprocess.check_call(["meson", "--version"])
except FileNotFoundError:
@@ -44,17 +51,20 @@ def install_temp(tmpdir_factory):
if sys.platform == "win32":
subprocess.check_call(["meson", "setup",
"--buildtype=release",
- "--vsenv", str(srcdir)],
+ "--vsenv", "--native-file", native_file,
+ str(srcdir)],
cwd=build_dir,
)
else:
- subprocess.check_call(["meson", "setup", str(srcdir)],
+ subprocess.check_call(["meson", "setup",
+ "--native-file", native_file, str(srcdir)],
cwd=build_dir
)
subprocess.check_call(["meson", "compile", "-vv"], cwd=build_dir)
sys.path.append(str(build_dir))
+
def test_is_timedelta64_object(install_temp):
import checks

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Apr 23 12:52:21 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch fix-meson-multiple-python-versions.patch:
* Ensure meson executes sys.executable when testing Cython.
-------------------------------------------------------------------
Tue Apr 16 19:12:21 UTC 2024 - Ben Greiner <code@bnavigator.de>

View File

@ -90,6 +90,8 @@ Patch1: numpy-1.9.0-remove-__declspec.patch
Patch2: 0001-BUG-Fix-test_impossible_feature_enable-failing-witho.patch
# PATCH-FIX-UPSTREAM https://github.com/numpy/meson/pull/12
Patch3: 0001-feature-module-Fix-handling-of-multiple-conflicts-pe.patch
# PATCH-FIX-UPSTREAM Based on gh#numpy/numpy#25839
Patch4: fix-meson-multiple-python-versions.patch
BuildRequires: %{python_module Cython >= 3.0}
BuildRequires: %{python_module base >= 3.9}
BuildRequires: %{python_module devel}
@ -366,8 +368,7 @@ export PYTHONPATH=%{buildroot}%{$python_sitearch}
export PYTHONDONTWRITEBYTECODE=1
[ -n "$test_failok" ] && $python runobstest.py "${test_failok:4}" ||:
# test_new_policy: duplicates test runs and output and does not follow our deselection
# test_cython: https://github.com/numpy/numpy/issues/24956
$python runobstest.py "not (test_new_policy ${test_failok} or slow or test_cython)"
$python runobstest.py "not (test_new_policy ${test_failok} or slow)"
}
popd