From e098f22b88222cac7d00b09de0ac1302768c7319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Mon, 31 Jul 2023 18:00:28 +0200 Subject: [PATCH] Fix build failure with Cython 3 --- ...445b6439f3ce7bffc4cf11c6407c39faedc5.patch | 63 +++++++++++++++++++ scipy.spec | 3 + 2 files changed, 66 insertions(+) create mode 100644 3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch diff --git a/3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch b/3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch new file mode 100644 index 0000000..87b3c3f --- /dev/null +++ b/3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch @@ -0,0 +1,63 @@ +From 3c89445b6439f3ce7bffc4cf11c6407c39faedc5 Mon Sep 17 00:00:00 2001 +From: Matus Valo +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 +--- + 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 d5a0bdd758e0..d35f8da68b34 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 359ea8418ba3..ee8def39b4d3 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 26458b05cd70..4c5ab798316b 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_blas_pxd, _dummy_init_optimize]) ++ depends : [_cython_tree, cython_blas_pxd, cython_optimize_pxd, _dummy_init_optimize]) + + _bglu_dense_c = opt_gen.process('_bglu_dense.pyx') + diff --git a/scipy.spec b/scipy.spec index 42124cb..5a1fc11 100644 --- a/scipy.spec +++ b/scipy.spec @@ -34,6 +34,9 @@ License: BSD and Boost and Public Domain Url: http://www.scipy.org/scipylib/index.html Source0: https://github.com/scipy/scipy/releases/download/v%{version}/scipy-%{version}.tar.gz +# Fix build failure with Cython 3 when scipy is already installed +Patch: https://github.com/scipy/scipy/commit/3c89445b6439f3ce7bffc4cf11c6407c39faedc5.patch + BuildRequires: fftw-devel, suitesparse-devel BuildRequires: %{blaslib}-devel BuildRequires: gcc-gfortran, swig, gcc-c++