Accepting request 1173493 from home:bnavigator:branches:devel:languages:python:numeric

- Replace revert-to-numpy1.patch by numexpr-pr485-allow-numpy1.patch
  in order to be able to compile with either numpy major version

OBS-URL: https://build.opensuse.org/request/show/1173493
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-numexpr?expand=0&rev=39
This commit is contained in:
2024-05-12 22:14:42 +00:00
committed by Git OBS Bridge
parent 9c5d272880
commit 48131fa090
4 changed files with 37 additions and 34 deletions

View File

@@ -0,0 +1,28 @@
From b35f5fcbd8447cb36268d0d344c8ef65b1912187 Mon Sep 17 00:00:00 2001
From: Sebastian Berg <sebastianb@nvidia.com>
Date: Wed, 8 May 2024 15:31:04 +0200
Subject: [PATCH] MAINT: Allow building with NumPy 1.x locally
I have build locally without build isolation and it seems to work
fine.
---
numexpr/interpreter.cpp | 6 ++++++
1 file changed, 6 insertions(+)
Index: numexpr-2.10.0/numexpr/interpreter.cpp
===================================================================
--- numexpr-2.10.0.orig/numexpr/interpreter.cpp
+++ numexpr-2.10.0/numexpr/interpreter.cpp
@@ -47,6 +47,12 @@
#define AVAILABLE(Haystack, Haystack_Len, J, Needle_Len) \
((Haystack_Len) >= (J) + (Needle_Len))
+// To allow building with NumPy<2 locally define the new NumPy macros:
+#if NPY_ABI_VERSION < 0x02000000
+ #define PyDataType_ELSIZE(descr) ((descr)->elsize)
+ #define PyDataType_SET_ELSIZE(descr, size) (descr)->elsize = size
+#endif
+
#include "str-two-way.hpp"
#ifdef DEBUG

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Sat May 11 19:48:33 UTC 2024 - Ben Greiner <code@bnavigator.de>
- Replace revert-to-numpy1.patch by numexpr-pr485-allow-numpy1.patch
in order to be able to compile with either numpy major version
-------------------------------------------------------------------
Mon Apr 22 09:57:01 UTC 2024 - Markéta Machová <mmachova@suse.com>

View File

@@ -25,10 +25,10 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/pydata/numexpr/
Source: https://files.pythonhosted.org/packages/source/n/numexpr/numexpr-%{version}.tar.gz
# PATCH-FIX-UPSTREAM revert of https://github.com/pydata/numexpr/commit/beedecb3990d604d0f272c1a2f9a1d117f6120ba to enable numpy v1 again, drop when numpy is updated to v2
Patch0: revert-to-numpy1.patch
# PATCH-FIX-UPSTREAM numexpr-pr485-allow-numpy1.patch gh#pydata/numexpr#485, see also comments in gh#pydata/numexpr#478
Patch0: numexpr-pr485-allow-numpy1.patch
BuildRequires: %{python_module devel >= 3.7}
# Until numpy 2 is in Factory, keep allowing to build with numpy 1.x. See comments in pyproject.toml for scipy and pandas
# Until numpy 2 is in Factory, keep allowing to build with numpy 1.x. See Patch0
BuildRequires: %{python_module numpy-devel >= 1.19.3}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}

View File

@@ -1,31 +0,0 @@
From beedecb3990d604d0f272c1a2f9a1d117f6120ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= <cr52@protonmail.com>
Date: Mon, 1 Apr 2024 14:43:52 +0200
Subject: Revert: [PATCH] BLD: fix compiling against numpy 2.0
---
numexpr/interpreter.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: numexpr-2.10.0/numexpr/interpreter.cpp
===================================================================
--- numexpr-2.10.0.orig/numexpr/interpreter.cpp
+++ numexpr-2.10.0/numexpr/interpreter.cpp
@@ -1203,7 +1203,7 @@ NumExpr_run(NumExprObject *self, PyObjec
Py_INCREF(dtypes[0]);
} else { // constant, like in '"foo"'
dtypes[0] = PyArray_DescrNewFromType(NPY_STRING);
- PyDataType_SET_ELSIZE(dtypes[0], (npy_intp)self->memsizes[1]);
+ dtypes[0]->elsize = (int)self->memsizes[1];
} // no string temporaries, so no third case
}
if (dtypes[0] == NULL) {
@@ -1449,7 +1449,7 @@ NumExpr_run(NumExprObject *self, PyObjec
/* Get the sizes of all the operands */
dtypes_tmp = NpyIter_GetDescrArray(iter);
for (i = 0; i < n_inputs+1; ++i) {
- self->memsizes[i] = PyDataType_ELSIZE(dtypes_tmp[i]);
+ self->memsizes[i] = dtypes_tmp[i]->elsize;
}
/* For small calculations, just use 1 thread */