!54 Fix scipy compile error in cython3
From: @SuperSix173 Reviewed-by: @wangbin224 Signed-off-by: @wangbin224
This commit is contained in:
commit
f68fa9ec47
66
0001-BLD-copy-cython_optimize.pxd-to-build-dir-18810.patch
Normal file
66
0001-BLD-copy-cython_optimize.pxd-to-build-dir-18810.patch
Normal file
@ -0,0 +1,66 @@
|
||||
From 3c89445b6439f3ce7bffc4cf11c6407c39faedc5 Mon Sep 17 00:00:00 2001
|
||||
From: Matus Valo <matusvalo@users.noreply.github.com>
|
||||
Date: Thu, 6 Jul 2023 16:55:25 +0200
|
||||
Subject: [PATCH] BLD: copy `cython_optimize.pxd` to build dir (#18810)
|
||||
|
||||
Closes gh-18792
|
||||
|
||||
[skip cirrus] [skip circle]
|
||||
|
||||
---------
|
||||
|
||||
Co-authored-by: Ralf Gommers <ralf.gommers@gmail.com>
|
||||
---
|
||||
scipy/optimize/cython_optimize.pxd | 2 +-
|
||||
scipy/optimize/cython_optimize/meson.build | 1 +
|
||||
scipy/optimize/meson.build | 8 +++++++-
|
||||
3 files changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/scipy/optimize/cython_optimize.pxd b/scipy/optimize/cython_optimize.pxd
|
||||
index d5a0bdd75..d35f8da68 100644
|
||||
--- a/scipy/optimize/cython_optimize.pxd
|
||||
+++ b/scipy/optimize/cython_optimize.pxd
|
||||
@@ -7,5 +7,5 @@
|
||||
# support. Changing it causes an ABI forward-compatibility break
|
||||
# (gh-11793), so we currently leave it as is (no further cimport
|
||||
# statements should be used in this file).
|
||||
-from .cython_optimize._zeros cimport (
|
||||
+from scipy.optimize.cython_optimize._zeros cimport (
|
||||
brentq, brenth, ridder, bisect, zeros_full_output)
|
||||
diff --git a/scipy/optimize/cython_optimize/meson.build b/scipy/optimize/cython_optimize/meson.build
|
||||
index 359ea8418..ee8def39b 100644
|
||||
--- a/scipy/optimize/cython_optimize/meson.build
|
||||
+++ b/scipy/optimize/cython_optimize/meson.build
|
||||
@@ -17,6 +17,7 @@ cy_opt_gen = generator(cython,
|
||||
arguments : cython_args,
|
||||
output : '@BASENAME@.c',
|
||||
depends : [_cython_tree,
|
||||
+ cython_optimize_pxd,
|
||||
_dummy_init_optimize,
|
||||
_dummy_init_cyoptimize])
|
||||
|
||||
diff --git a/scipy/optimize/meson.build b/scipy/optimize/meson.build
|
||||
index 26458b05c..4c5ab7983 100644
|
||||
--- a/scipy/optimize/meson.build
|
||||
+++ b/scipy/optimize/meson.build
|
||||
@@ -206,10 +206,16 @@ endif
|
||||
|
||||
_dummy_init_optimize = fs.copyfile('__init__.py')
|
||||
|
||||
+# Copying this .pxd file is only needed because of a Cython bug, see
|
||||
+# discussion on SciPy PR gh-18810.
|
||||
+cython_optimize_pxd = [
|
||||
+ fs.copyfile('cython_optimize.pxd'),
|
||||
+]
|
||||
+
|
||||
opt_gen = generator(cython,
|
||||
arguments : cython_args,
|
||||
output : '@BASENAME@.c',
|
||||
- depends : [_cython_tree, cython_linalg, _dummy_init_optimize])
|
||||
+ depends : [_cython_tree, cython_linalg, cython_optimize_pxd, _dummy_init_optimize])
|
||||
|
||||
_bglu_dense_c = opt_gen.process('_bglu_dense.pyx')
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
47
0001-MAINT-Allow-scipy-to-be-compiled-in-cython3-18242.patch
Normal file
47
0001-MAINT-Allow-scipy-to-be-compiled-in-cython3-18242.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From a181fd5b75f2e05d1b7beafbb48157feaa468941 Mon Sep 17 00:00:00 2001
|
||||
From: Matus Valo <matusvalo@users.noreply.github.com>
|
||||
Date: Wed, 3 May 2023 22:22:36 +0200
|
||||
Subject: [PATCH] MAINT: Allow scipy to be compiled in cython3 (#18242)
|
||||
|
||||
- Unpin Cython and use Cython master in the pre-release CI job
|
||||
- Use absolute instead of relative imports in a few places
|
||||
- Use `CYTHON_EXTERN_C` for C++ code exposing a C API
|
||||
|
||||
[skip ci]
|
||||
---
|
||||
.github/workflows/linux_meson.yml | 5 ++---
|
||||
scipy/linalg.pxd | 2 +-
|
||||
scipy/special.pxd | 2 +-
|
||||
scipy/special/meson.build | 2 +-
|
||||
4 files changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/scipy/linalg.pxd b/scipy/linalg.pxd
|
||||
index 1f656b870..c7c49f9ad 100644
|
||||
--- a/scipy/linalg.pxd
|
||||
+++ b/scipy/linalg.pxd
|
||||
@@ -1 +1 @@
|
||||
-from .linalg cimport cython_blas, cython_lapack
|
||||
+from scipy.linalg cimport cython_blas, cython_lapack
|
||||
diff --git a/scipy/special.pxd b/scipy/special.pxd
|
||||
index 62cb82807..1daa9fb37 100644
|
||||
--- a/scipy/special.pxd
|
||||
+++ b/scipy/special.pxd
|
||||
@@ -1 +1 @@
|
||||
-from .special cimport cython_special
|
||||
+from scipy.special cimport cython_special
|
||||
diff --git a/scipy/special/meson.build b/scipy/special/meson.build
|
||||
index 334f87943..e7e25aa54 100644
|
||||
--- a/scipy/special/meson.build
|
||||
+++ b/scipy/special/meson.build
|
||||
@@ -371,7 +371,7 @@ py3.extension_module('_ufuncs_cxx',
|
||||
[ufuncs_cxx_sources,
|
||||
uf_cython_gen_cpp.process(cython_special[2]), # _ufuncs_cxx.pyx
|
||||
],
|
||||
- cpp_args: cython_cpp_args,
|
||||
+ cpp_args: [cython_cpp_args, '-DCYTHON_EXTERN_C=extern "C"'],
|
||||
include_directories: [inc_np, '../_lib/boost', '../_lib',
|
||||
'../_build_utils/src'],
|
||||
link_args: version_link_args,
|
||||
--
|
||||
2.23.0
|
||||
|
||||
4330
0001-MAINT-Explicitly-mark-cdef-functions-not-raising-exc.patch
Normal file
4330
0001-MAINT-Explicitly-mark-cdef-functions-not-raising-exc.patch
Normal file
File diff suppressed because it is too large
Load Diff
67
0001-Mark-function-pointer-ctypedefs-as-noexcept.patch
Normal file
67
0001-Mark-function-pointer-ctypedefs-as-noexcept.patch
Normal file
@ -0,0 +1,67 @@
|
||||
From 50d0825256ddb76c5567e6cc8eb50e7d36908e21 Mon Sep 17 00:00:00 2001
|
||||
From: Matus Valo <matusvalo@gmail.com>
|
||||
Date: Mon, 17 Apr 2023 23:00:04 +0200
|
||||
Subject: [PATCH] Mark function pointer ctypedefs as noexcept
|
||||
|
||||
---
|
||||
scipy/cluster/_hierarchy_distance_update.pxi | 2 +-
|
||||
scipy/optimize/cython_optimize/_zeros.pxd | 2 +-
|
||||
scipy/stats/_qmc_cy.pyx | 2 +-
|
||||
scipy/stats/_unuran/unuran_wrapper.pyx.templ | 2 +-
|
||||
4 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/scipy/cluster/_hierarchy_distance_update.pxi b/scipy/cluster/_hierarchy_distance_update.pxi
|
||||
index 17dedb305..bc57a3fa1 100644
|
||||
--- a/scipy/cluster/_hierarchy_distance_update.pxi
|
||||
+++ b/scipy/cluster/_hierarchy_distance_update.pxi
|
||||
@@ -24,7 +24,7 @@ d_xyi : double
|
||||
"""
|
||||
ctypedef double (*linkage_distance_update)(double d_xi, double d_yi,
|
||||
double d_xy, int size_x,
|
||||
- int size_y, int size_i)
|
||||
+ int size_y, int size_i) noexcept
|
||||
|
||||
|
||||
cdef double _single(double d_xi, double d_yi, double d_xy,
|
||||
diff --git a/scipy/optimize/cython_optimize/_zeros.pxd b/scipy/optimize/cython_optimize/_zeros.pxd
|
||||
index c6241d022..d3c9e98f0 100644
|
||||
--- a/scipy/optimize/cython_optimize/_zeros.pxd
|
||||
+++ b/scipy/optimize/cython_optimize/_zeros.pxd
|
||||
@@ -4,7 +4,7 @@
|
||||
# should be made to this file** --- any API additions/changes should be
|
||||
# done in `cython_optimize.pxd` (see gh-11793).
|
||||
|
||||
-ctypedef double (*callback_type)(double, void*)
|
||||
+ctypedef double (*callback_type)(double, void*) noexcept
|
||||
|
||||
ctypedef struct zeros_parameters:
|
||||
callback_type function
|
||||
diff --git a/scipy/stats/_qmc_cy.pyx b/scipy/stats/_qmc_cy.pyx
|
||||
index f165cb0d1..a9e94354f 100644
|
||||
--- a/scipy/stats/_qmc_cy.pyx
|
||||
+++ b/scipy/stats/_qmc_cy.pyx
|
||||
@@ -290,7 +290,7 @@ cdef double c_update_discrepancy(double[::1] x_new_view,
|
||||
|
||||
|
||||
ctypedef double (*func_type)(double[:, ::1], Py_ssize_t,
|
||||
- Py_ssize_t) nogil
|
||||
+ Py_ssize_t) noexcept nogil
|
||||
|
||||
|
||||
cdef double threaded_loops(func_type loop_func,
|
||||
diff --git a/scipy/stats/_unuran/unuran_wrapper.pyx.templ b/scipy/stats/_unuran/unuran_wrapper.pyx.templ
|
||||
index 2279dfc34..9eb63fb1c 100644
|
||||
--- a/scipy/stats/_unuran/unuran_wrapper.pyx.templ
|
||||
+++ b/scipy/stats/_unuran/unuran_wrapper.pyx.templ
|
||||
@@ -58,7 +58,7 @@ class UNURANError(RuntimeError):
|
||||
pass
|
||||
|
||||
|
||||
-ctypedef double (*URNG_FUNCT)(void *) nogil
|
||||
+ctypedef double (*URNG_FUNCT)(void *) noexcept nogil
|
||||
|
||||
IF not NPY_OLD:
|
||||
cdef object get_numpy_rng(object seed = None):
|
||||
--
|
||||
2.23.0
|
||||
|
||||
10
scipy.spec
10
scipy.spec
@ -2,12 +2,17 @@
|
||||
%global debug_package %{nil}
|
||||
Name: scipy
|
||||
Version: 1.10.1
|
||||
Release: 2
|
||||
Release: 3
|
||||
Summary: A Python-based ecosystem of open-source software for mathematics, science, and engineering
|
||||
License: Qhull and Apache-2.0
|
||||
URL: https://www.scipy.org
|
||||
Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz
|
||||
|
||||
Patch6001: 0001-MAINT-Explicitly-mark-cdef-functions-not-raising-exc.patch
|
||||
Patch6002: 0001-Mark-function-pointer-ctypedefs-as-noexcept.patch
|
||||
Patch6003: 0001-MAINT-Allow-scipy-to-be-compiled-in-cython3-18242.patch
|
||||
Patch6004: 0001-BLD-copy-cython_optimize.pxd-to-build-dir-18810.patch
|
||||
|
||||
BuildRequires: python3-devel python3-numpy >= 1.8.2 python3-numpy-f2py
|
||||
BuildRequires: gcc-c++ openblas-devel gcc-gfortran chrpath
|
||||
BuildRequires: pybind11-devel python3-pybind11 python3-Cython
|
||||
@ -101,6 +106,9 @@ echo "%{_libdir}/%{name}" >> $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.c
|
||||
%config(noreplace) /etc/ld.so.conf.d/*
|
||||
|
||||
%changelog
|
||||
* Thu Feb 1 2024 Liu Chao <liuchao173@huawei.com> - 1.10.1-3
|
||||
- Fix scipy compile error in cython3
|
||||
|
||||
* Mon Sep 11 2023 liyunfei <liyunfei@huawei.com> - 1.10.1-2
|
||||
- add clang compile support
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user