From 33a6f574a9c3b1e4e23ade0ac90142f84568fa90d8447eb0ffe3573c7bcfd904 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 23 Apr 2024 12:52:48 +0000 Subject: [PATCH] - 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 --- fix-meson-multiple-python-versions.patch | 53 ++++++++++++++++++++++++ python-numpy.changes | 6 +++ python-numpy.spec | 5 ++- 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 fix-meson-multiple-python-versions.patch diff --git a/fix-meson-multiple-python-versions.patch b/fix-meson-multiple-python-versions.patch new file mode 100644 index 0000000..d8d77f9 --- /dev/null +++ b/fix-meson-multiple-python-versions.patch @@ -0,0 +1,53 @@ +From 59694be29a71b17ad1ce58c865a5524c50bfedee Mon Sep 17 00:00:00 2001 +From: Ralf Gommers +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 + diff --git a/python-numpy.changes b/python-numpy.changes index 0ad9e3d..eddb273 100644 --- a/python-numpy.changes +++ b/python-numpy.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Apr 23 12:52:21 UTC 2024 - Steve Kowalik + +- 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 diff --git a/python-numpy.spec b/python-numpy.spec index 5c6dbc4..d9ffbff 100644 --- a/python-numpy.spec +++ b/python-numpy.spec @@ -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