Compare commits

...

6 Commits

Author SHA1 Message Date
David Abdurachmanov d66007b965
Merge remote-tracking branch 'up/main' into main-riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2023-12-01 17:38:58 +02:00
Gwyn Ciesla 82c3521ddb Fix on Python 3.13 2023-11-20 11:00:42 -06:00
Miro Hrončok 8b0cbaca90 Fix FTBFS with Python 3.13.0a1+
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2247014

Co-Authored-By: Karolina Surma <ksurma@redhat.com>
2023-11-20 13:05:17 +01:00
Miro Hrončok 0cf52f243c Don't hardcode Python version in paths 2023-11-16 20:45:47 +01:00
Miro Hrončok 2d292fb79f Use %pyproject_buildrequires
Manually listing the dependencies for %pyproject_wheel is not supported.

Note that the vendored mesonpy build backend does not support generating
runtime metadata, so we use -R (no runtime requires). We could use -w instead,
but that would build the wheel too many times.

The dependency on patchelf is added for mesonpy.
When /usr/bin/patchelf does not exist, it tries to generate a dependency on
python3dist(patchelf), see the comment in pyproject.toml.
2023-11-06 18:24:32 +01:00
Yaakov Selkowitz 939d04bda8 Add pyproject-rpms-macros dependency
This dependency is added automatically only when using
%pyproject_generate_buildrequires, which is not the case here.  While
Fedora python3-devel pulls it in anyway, RHEL/ELN does not.
2023-11-05 23:36:11 -05:00
3 changed files with 119 additions and 11 deletions

View File

@ -0,0 +1,64 @@
From 7ade3828313dd437f4e2176ccbbc1ef52322de15 Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Fri, 20 Oct 2023 17:29:26 +0200
Subject: [PATCH] Stop using removed `importlib.resources` functions on Python
>=3.13
Closes gh-12401
---
vendored-meson/meson/mesonbuild/dependencies/python.py | 8 +++++++-
vendored-meson/meson/mesonbuild/modules/python.py | 7 +++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/vendored-meson/meson/mesonbuild/dependencies/python.py b/vendored-meson/meson/mesonbuild/dependencies/python.py
index 1607728883df..186a6830ddbf 100644
--- a/vendored-meson/meson/mesonbuild/dependencies/python.py
+++ b/vendored-meson/meson/mesonbuild/dependencies/python.py
@@ -15,6 +15,7 @@
import functools, json, os, textwrap
from pathlib import Path
+import sys
import typing as T
from .. import mesonlib, mlog
@@ -110,8 +111,13 @@ def sanity(self) -> bool:
# Sanity check, we expect to have something that at least quacks in tune
import importlib.resources
+ if sys.version_info >= (3, 13):
+ traversable = importlib.resources.files('mesonbuild.scripts').joinpath('python_info.py')
+ context_mgr = importlib.resources.as_file(traversable)
+ else:
+ context_mgr = importlib.resources.path('mesonbuild.scripts', 'python_info.py')
- with importlib.resources.path('mesonbuild.scripts', 'python_info.py') as f:
+ with context_mgr as f:
cmd = self.get_command() + [str(f)]
p, stdout, stderr = mesonlib.Popen_safe(cmd)
diff --git a/vendored-meson/meson/mesonbuild/modules/python.py b/vendored-meson/meson/mesonbuild/modules/python.py
index ac74e13dc5b7..baeb85936614 100644
--- a/vendored-meson/meson/mesonbuild/modules/python.py
+++ b/vendored-meson/meson/mesonbuild/modules/python.py
@@ -13,7 +13,7 @@
# limitations under the License.
from __future__ import annotations
-import copy, json, os, shutil
+import copy, json, os, shutil, sys
import typing as T
from . import ExtensionModule, ModuleInfo
@@ -329,7 +329,10 @@ def should_append(f, isdir: bool = False):
import importlib.resources
pycompile = os.path.join(self.interpreter.environment.get_scratch_dir(), 'pycompile.py')
with open(pycompile, 'wb') as f:
- f.write(importlib.resources.read_binary('mesonbuild.scripts', 'pycompile.py'))
+ if sys.version_info >= (3, 13):
+ f.write(importlib.resources.files('mesonbuild.scripts').joinpath('pycompile.py').read_bytes())
+ else:
+ f.write(importlib.resources.read_binary('mesonbuild.scripts', 'pycompile.py'))
for i in self.installations.values():
if isinstance(i, PythonExternalProgram) and i.run_bytecompile[i.info['version']]:

View File

@ -20,7 +20,7 @@
Name: numpy
Version: 1.26.0
Release: 1.1.riscv64%{?dist}
Release: 2.0.riscv64%{?dist}
Epoch: 1
Summary: A fast multidimensional array facility for Python
@ -32,6 +32,13 @@ Source1: https://numpy.org/doc/%(echo %{version} | cut -d. -f1-2)/numpy-h
Patch0: f2py_test.patch
Patch1: 24772.patch
Patch2: 24776.patch
# Python 3.13: Patch vendored meson to work around the removed functions from importlib.resources
# Upstream commit: https://github.com/numpy/meson/commit/7ade3828313dd437f4e2176ccbbc1ef52322de15
Patch3: don-t-use-the-removed-importlib.patch
# Python 3.13: Replace deprecated ctypes.ARRAY(item_type, size) with item_type * size
# Upstream PR: https://github.com/numpy/numpy/pull/25198
Patch4: replace-deprecated-ctypes.ARRAY.patch
%description
NumPy is a general-purpose array-processing package designed to
@ -58,13 +65,10 @@ Provides: numpy%{?_isa} = %{epoch}:%{version}-%{release}
Obsoletes: numpy < 1:1.10.1-3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
BuildRequires: python3-Cython
BuildRequires: python3-pyproject-metadata
BuildRequires: gcc-gfortran gcc gcc-c++
BuildRequires: lapack-devel
BuildRequires: ninja-build
BuildRequires: patchelf
%if %{with tests}
BuildRequires: python3-hypothesis
BuildRequires: python3-pytest
@ -112,6 +116,10 @@ This package provides the complete documentation for NumPy.
%prep
%autosetup -n %{name}-%{version} -p1
# Enable build with Python 3.13
# See: https://github.com/numpy/numpy/commit/82d7657ce39c97fcfd86e1a5acee8b5d00682169
sed -i 's/requires-python = ">=3.9,<3.13"/requires-python = ">=3.9"/' pyproject.toml
# openblas is provided by flexiblas by default; otherwise,
# Use openblas pthreads as recommended by upstream (see comment in site.cfg.example)
cat >> site.cfg <<EOF
@ -120,6 +128,9 @@ libraries = %{blaslib}%{blasvar}
library_dirs = %{_libdir}
EOF
%generate_buildrequires
%pyproject_buildrequires -R -Csetup-args=-Dblas=flexiblas -Csetup-args=-Dlapack=lapack
%build
%set_build_flags
@ -134,7 +145,7 @@ popd
%pyproject_install
pushd %{buildroot}%{_bindir} &> /dev/null
ln -s f2py f2py3
ln -s f2py f2py3.12
ln -s f2py f2py%{python3_version}
ln -s f2py3 f2py.numpy
popd &> /dev/null
@ -153,11 +164,16 @@ export PYTHONPATH=%{buildroot}%{python3_sitearch}
# Some tests also overflow on 32bit
%global ix86_k and not test_vector_matrix_values and not test_matrix_vector_values and not test_identityless_reduction_huge_array and not (TestKind and test_all)
%endif
# test_deprecate_... fail on Python 3.13+ due to docstrings being dedented
# Upstream has removed the tests in git HEAD.
%if v"0%{python3_version}" >= v"3.13"
%global py313_k and not test_deprecate_help_indentation and not test_deprecate_preserve_whitespace
%endif
%ifarch riscv64
%global riscv64_k and not test_fpclass and not test_fp_noncontiguous and not (TestBoolCmp and test_float)
%endif
%ifnarch %{ix86}
python3 runtests.py --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{?ix86_k} %{?riscv64_k}' \
python3 runtests.py --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{?ix86_k} %{?riscv64_k} %{?py313_k}' \
-W "ignore:pkg_resources is deprecated as an API::pkg_resources"
%endif
@ -205,12 +221,12 @@ python3 runtests.py --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{
%changelog
* Mon Nov 06 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1:1.26.0-1.1.riscv64
- Rebuild for Python 3.12 (riscv64)
* Sat Oct 21 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1:1.26.0-1.0.riscv64
* Fri Dec 01 2023 David Abdurachmanov <davidlt@rivosinc.com> - 1:1.26.0-2.0.riscv64
- Skip failing tests on riscv64
* Mon Nov 20 2023 Gwyn Ciesla <gwync@protonmail.com> - 1:1.26.0-2
- Fix FTBFS with Python 3.13.
* Tue Sep 19 2023 Gwyn Ciesla <gwync@protonmail.com> - 1:1.26.0-1
- 1.26.0

View File

@ -0,0 +1,28 @@
From d9155244ea06705ebd9194cc7a621e82316b61ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 20 Nov 2023 11:36:36 +0100
Subject: [PATCH] MAINT: Replace deprecated ctypes.ARRAY(item_type, size) with
item_type * size
See https://github.com/python/cpython/issues/105733
---
numpy/core/tests/test_ufunc.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/numpy/core/tests/test_ufunc.py b/numpy/core/tests/test_ufunc.py
index a7401ff616f..fc1fd5af169 100644
--- a/numpy/core/tests/test_ufunc.py
+++ b/numpy/core/tests/test_ufunc.py
@@ -2985,9 +2985,9 @@ def test_resolve_dtypes_reduction_errors(self):
reason="`ctypes.pythonapi` required for capsule unpacking.")
def test_loop_access(self):
# This is a basic test for the full strided loop access
- data_t = ct.ARRAY(ct.c_char_p, 2)
- dim_t = ct.ARRAY(ct.c_ssize_t, 1)
- strides_t = ct.ARRAY(ct.c_ssize_t, 2)
+ data_t = ct.c_char_p * 2
+ dim_t = ct.c_ssize_t * 1
+ strides_t = ct.c_ssize_t * 2
strided_loop_t = ct.CFUNCTYPE(
ct.c_int, ct.c_void_p, data_t, dim_t, strides_t, ct.c_void_p)