mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
python3Packages.numba: fix numpy 2.5 compat (#536277)
This commit is contained in:
commit
213e331154
3 changed files with 43 additions and 40 deletions
|
|
@ -4,7 +4,6 @@
|
|||
fetchFromGitHub,
|
||||
buildPythonPackage,
|
||||
replaceVars,
|
||||
fetchpatch,
|
||||
|
||||
# nativeBuildInputs
|
||||
setuptools,
|
||||
|
|
@ -16,8 +15,8 @@
|
|||
# tests
|
||||
numba,
|
||||
pytestCheckHook,
|
||||
pytest-xdist,
|
||||
writableTmpDirAsHomeHook,
|
||||
numpy_1,
|
||||
writers,
|
||||
python,
|
||||
|
||||
|
|
@ -56,11 +55,26 @@ buildPythonPackage (finalAttrs: {
|
|||
hash = "sha256-DMmUyTElDFyMK4BUQ4EhDNmG43lOWQHurKbnSyhAs5k=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./numpy2.5.patch
|
||||
]
|
||||
++ lib.optionals cudaSupport [
|
||||
(replaceVars ./cuda_path.patch {
|
||||
cuda_toolkit_path = cudatoolkit;
|
||||
cuda_toolkit_lib_path = lib.getLib cudatoolkit;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace numba/cuda/cudadrv/driver.py \
|
||||
--replace-fail \
|
||||
"dldir = [" \
|
||||
"dldir = [ '${addDriverRunpath.driverLink}/lib', "
|
||||
|
||||
substituteInPlace setup.py \
|
||||
--replace-fail 'max_numpy_run_version = "2.5"' 'max_numpy_run_version = "2.6"'
|
||||
substituteInPlace numba/__init__.py \
|
||||
--replace-fail "(2, 4)" "(2, 6)"
|
||||
'';
|
||||
|
||||
build-system = [
|
||||
|
|
@ -84,15 +98,9 @@ buildPythonPackage (finalAttrs: {
|
|||
llvmlite
|
||||
];
|
||||
|
||||
patches = lib.optionals cudaSupport [
|
||||
(replaceVars ./cuda_path.patch {
|
||||
cuda_toolkit_path = cudatoolkit;
|
||||
cuda_toolkit_lib_path = lib.getLib cudatoolkit;
|
||||
})
|
||||
];
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
pytest-xdist
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
|
|
@ -145,9 +153,6 @@ buildPythonPackage (finalAttrs: {
|
|||
doFullCheck = true;
|
||||
testsWithoutSandbox = false;
|
||||
};
|
||||
numpy_1 = numba.override {
|
||||
numpy = numpy_1;
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
|||
|
|
@ -1,28 +0,0 @@
|
|||
diff --git a/numba/__init__.py b/numba/__init__.py
|
||||
index 33f752018..7d3b3ae8d 100644
|
||||
--- a/numba/__init__.py
|
||||
+++ b/numba/__init__.py
|
||||
@@ -39,8 +39,8 @@ def _ensure_critical_deps():
|
||||
f"{numpy_version[0]}.{numpy_version[1]}.")
|
||||
raise ImportError(msg)
|
||||
|
||||
- if numpy_version > (2, 3):
|
||||
- msg = (f"Numba needs NumPy 2.3 or less. Got NumPy "
|
||||
+ if numpy_version > (2, 4):
|
||||
+ msg = (f"Numba needs NumPy 2.4 or less. Got NumPy "
|
||||
f"{numpy_version[0]}.{numpy_version[1]}.")
|
||||
raise ImportError(msg)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 9eaa191cb..a5febef1e 100644
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -23,7 +23,7 @@ min_python_version = "3.10"
|
||||
max_python_version = "3.15" # exclusive
|
||||
min_numpy_build_version = "2.0.0rc1"
|
||||
min_numpy_run_version = "1.22"
|
||||
-max_numpy_run_version = "2.4"
|
||||
+max_numpy_run_version = "2.5"
|
||||
min_llvmlite_version = "0.46.0dev0"
|
||||
max_llvmlite_version = "0.47"
|
||||
|
||||
26
pkgs/development/python-modules/numba/numpy2.5.patch
Normal file
26
pkgs/development/python-modules/numba/numpy2.5.patch
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/numba/np/arrayobj.py b/numba/np/arrayobj.py
|
||||
index ae81627ec..dd69a2a45 100644
|
||||
--- a/numba/np/arrayobj.py
|
||||
+++ b/numba/np/arrayobj.py
|
||||
@@ -6639,7 +6639,7 @@ def impl_np_vstack(tup):
|
||||
return impl
|
||||
|
||||
|
||||
-if numpy_version >= (2, 0):
|
||||
+if (2, 0) <= numpy_version < (2, 5):
|
||||
overload(np.row_stack)(impl_np_vstack)
|
||||
|
||||
|
||||
diff --git a/numba/tests/test_dyn_array.py b/numba/tests/test_dyn_array.py
|
||||
index 99328052c..dfbf57589 100644
|
||||
--- a/numba/tests/test_dyn_array.py
|
||||
+++ b/numba/tests/test_dyn_array.py
|
||||
@@ -36,7 +36,7 @@ def np_vstack(a, b, c):
|
||||
return np.vstack((a, b, c))
|
||||
|
||||
def np_row_stack(a, b, c):
|
||||
- return np.row_stack((a, b, c))
|
||||
+ return np.vstack((a, b, c))
|
||||
|
||||
def np_dstack(a, b, c):
|
||||
return np.dstack((a, b, c))
|
||||
Loading…
Add table
Add a link
Reference in a new issue