gnu: python-scipy: Fix build on i686-linux.

* gnu/packages/patches/python-scipy-i686.patch: Add patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/python-science.scm (python-scipy): Add phase to apply the patch.

Fixes guix/guix#2989
Change-Id: I6c5d807bd2ed23fca6e94b28cb6927c154bde0e8
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Dariqq 2025-09-26 09:26:37 +00:00 committed by Sharlatan Hellseher
parent bef09e93b3
commit 5bb84e0b97
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5
3 changed files with 59 additions and 0 deletions

View file

@ -2185,6 +2185,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-pytorch-system-libraries.patch \ %D%/packages/patches/python-pytorch-system-libraries.patch \
%D%/packages/patches/python-pytorch-without-kineto.patch \ %D%/packages/patches/python-pytorch-without-kineto.patch \
%D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \ %D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
%D%/packages/patches/python-scipy-i686.patch \
%D%/packages/patches/python-vaex-core-fix-tsl-use.patch \ %D%/packages/patches/python-vaex-core-fix-tsl-use.patch \
%D%/packages/patches/python-vega-datasets-remove-la-riots-code.patch \ %D%/packages/patches/python-vega-datasets-remove-la-riots-code.patch \
%D%/packages/patches/python-versioneer-guix-support.patch \ %D%/packages/patches/python-versioneer-guix-support.patch \

View file

@ -0,0 +1,49 @@
From https://github.com/scipy/scipy/pull/20135
From 53796772ed735c1564863fc7ca8d902acb628167 Mon Sep 17 00:00:00 2001
From: Ralf Gommers <ralf.gommers@gmail.com>
Date: Thu, 22 Feb 2024 09:10:46 +0100
Subject: [PATCH] MAINT: interpolate: define `F_INT` as `int` rather than
`npy_int32`
This fixes an incompatible pointer issue that shows up as a warning in
Windows CI jobs, and is reported to break the build with GCC 14 on
Fedora 40 in gh-19993.
Using `#define F_INT int` is done in several other submodules; this
was the only instance of using `npy_int32`.
Closes gh-19993
---
scipy/interpolate/src/_fitpackmodule.c | 4 ++--
scipy/interpolate/src/fitpack.pyf | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scipy/interpolate/src/_fitpackmodule.c b/scipy/interpolate/src/_fitpackmodule.c
index 0e913d1c7e43..dc79b2b28833 100644
--- a/scipy/interpolate/src/_fitpackmodule.c
+++ b/scipy/interpolate/src/_fitpackmodule.c
@@ -28,8 +28,8 @@ static PyObject *fitpack_error;
#else
-#define F_INT npy_int32
-#define F_INT_NPY NPY_INT32
+#define F_INT int
+#define F_INT_NPY NPY_INT
#define F_INT_MAX NPY_MAX_INT32
#if NPY_BITSOF_SHORT == 32
#define F_INT_PYFMT "h"
diff --git a/scipy/interpolate/src/fitpack.pyf b/scipy/interpolate/src/fitpack.pyf
index 08cb0c141c98..a9535a83f479 100644
--- a/scipy/interpolate/src/fitpack.pyf
+++ b/scipy/interpolate/src/fitpack.pyf
@@ -16,7 +16,7 @@ python module dfitpack ! in
#ifdef HAVE_ILP64
typedef npy_int64 F_INT;
#else
-typedef npy_int32 F_INT;
+typedef int F_INT;
#endif
static double dmax(double* seq, F_INT len) {

View file

@ -3108,6 +3108,15 @@ cross-validation.")
(list (list
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
#$@(if (target-x86-32?)
#~((add-after 'unpack 'apply-i686-patch
(lambda _
(let ((patch-file
#$(local-file
(search-patch "python-scipy-i686.patch"))))
(invoke "patch" "--force" "-p1" "-i"
patch-file)))))
#~())
(replace 'check (replace 'check
(lambda* (#:key tests? #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(when tests? (when tests?