Apply compatibility patch with numpy 1.20
This commit is contained in:
parent
ba4c2165ce
commit
9ab8d534f2
|
@ -0,0 +1,118 @@
|
|||
From d70e59afd88263adafdc9f82578c152ea1987f24 Mon Sep 17 00:00:00 2001
|
||||
From: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
|
||||
Date: Tue, 5 Jan 2021 22:42:03 +0100
|
||||
Subject: [PATCH] Update to match numpy 1.20 changes
|
||||
|
||||
---
|
||||
pythran/tests/cases/goodExpoMeasure.py | 6 +++---
|
||||
pythran/tests/test_cases.py | 6 ++++++
|
||||
pythran/tests/test_ndarray.py | 7 +++++--
|
||||
pythran/tests/test_numpy_func2.py | 2 +-
|
||||
pythran/tests/test_typing.py | 2 +-
|
||||
5 files changed, 16 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/pythran/tests/cases/goodExpoMeasure.py b/pythran/tests/cases/goodExpoMeasure.py
|
||||
index 4c8f702..fc0d57b 100644
|
||||
--- a/pythran/tests/cases/goodExpoMeasure.py
|
||||
+++ b/pythran/tests/cases/goodExpoMeasure.py
|
||||
@@ -5,9 +5,9 @@ def goodExpoMeasure(inRGB, sigma):
|
||||
'''
|
||||
Compute the good exposition image quality measure on 1 input image.
|
||||
'''
|
||||
- R = inRGB[0,:,:].astype(numpy.float)
|
||||
- G = inRGB[1,:,:].astype(numpy.float)
|
||||
- B = inRGB[2,:,:].astype(numpy.float)
|
||||
+ R = inRGB[0,:,:].astype(numpy.float64)
|
||||
+ G = inRGB[1,:,:].astype(numpy.float64)
|
||||
+ B = inRGB[2,:,:].astype(numpy.float64)
|
||||
goodExpoR = numpy.exp(- ((R - 128)**2) / sigma)
|
||||
goodExpoG = numpy.exp(- ((G - 128)**2) / sigma)
|
||||
goodExpoB = numpy.exp(- ((B - 128)**2) / sigma)
|
||||
diff --git a/pythran/tests/test_cases.py b/pythran/tests/test_cases.py
|
||||
index 6a48ea4..15762ff 100644
|
||||
--- a/pythran/tests/test_cases.py
|
||||
+++ b/pythran/tests/test_cases.py
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
# TODO: check http://code.google.com/p/unladen-swallow/wiki/Benchmarks
|
||||
import os
|
||||
+from distutils.version import LooseVersion
|
||||
+import numpy
|
||||
import unittest
|
||||
|
||||
from pythran.tests import TestFromDir
|
||||
@@ -16,6 +18,9 @@ class TestCases(TestFromDir):
|
||||
|
||||
TestCases.populate(TestCases)
|
||||
|
||||
+if LooseVersion(numpy.__version__) >= '1.20':
|
||||
+ del TestCases.test_train_equalizer_norun0
|
||||
+
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
diff --git a/pythran/tests/test_ndarray.py b/pythran/tests/test_ndarray.py
|
||||
index a1dd634..b28cef5 100644
|
||||
--- a/pythran/tests/test_ndarray.py
|
||||
+++ b/pythran/tests/test_ndarray.py
|
||||
@@ -2,6 +2,7 @@ from pythran.tests import TestEnv
|
||||
from pythran.typing import NDArray, Tuple, List
|
||||
|
||||
import numpy
|
||||
+from distutils.version import LooseVersion
|
||||
|
||||
import unittest
|
||||
|
||||
@@ -271,12 +272,12 @@ class TestNdarray(TestEnv):
|
||||
self.run_test("""
|
||||
def numpy_np_float(n):
|
||||
import numpy
|
||||
- return numpy.ones(n, numpy.float)""",
|
||||
+ return numpy.ones(n, float)""",
|
||||
5,
|
||||
numpy_np_float=[int])
|
||||
|
||||
def test_numpy_complex(self):
|
||||
- self.run_test("def numpy_complex(n): import numpy ; return numpy.ones(n, numpy.complex)",
|
||||
+ self.run_test("def numpy_complex(n): import numpy ; return numpy.ones(n, complex)",
|
||||
5,
|
||||
numpy_complex=[int])
|
||||
|
||||
@@ -1092,6 +1093,8 @@ def complex_conversion0(x):
|
||||
5.,
|
||||
built_slice_indexing=[NDArray[float, :], int, int, float])
|
||||
|
||||
+ @unittest.skipIf(LooseVersion(numpy.__version__) >= '1.20',
|
||||
+ "numpy.dtype.type changed in 1.20.0")
|
||||
def test_dtype_type(self):
|
||||
self.run_test('''
|
||||
def dtype_type(x):
|
||||
diff --git a/pythran/tests/test_numpy_func2.py b/pythran/tests/test_numpy_func2.py
|
||||
index 0b3c441..53e105e 100644
|
||||
--- a/pythran/tests/test_numpy_func2.py
|
||||
+++ b/pythran/tests/test_numpy_func2.py
|
||||
@@ -753,7 +753,7 @@ def test_copy0(x):
|
||||
self.run_test("def np_empty_kwargs(a):\n from numpy import empty\n a = empty(a, dtype=int)\n return a.strides, len(a)", (3, 2), np_empty_kwargs=[Tuple[int, int]])
|
||||
|
||||
def test_empty_kwargs2(self):
|
||||
- self.run_test("def np_empty_kwargs2(a):\n from numpy import empty, float\n a = empty(a, dtype=float)\n return a.strides, a.shape", 3, np_empty_kwargs2=[int])
|
||||
+ self.run_test("def np_empty_kwargs2(a):\n from numpy import empty \n a = empty(a, dtype=float)\n return a.strides, a.shape", 3, np_empty_kwargs2=[int])
|
||||
|
||||
def test_arange(self):
|
||||
self.run_test("def np_arange_(a):\n from numpy import arange\n return arange(a, dtype=float)", 10, np_arange_=[int])
|
||||
diff --git a/pythran/tests/test_typing.py b/pythran/tests/test_typing.py
|
||||
index d10d7e6..a7a2934 100644
|
||||
--- a/pythran/tests/test_typing.py
|
||||
+++ b/pythran/tests/test_typing.py
|
||||
@@ -356,7 +356,7 @@ def recursive_interprocedural_typing2(c):
|
||||
print_type(numpy.ones(n, dtype=numpy.uint16).dtype)
|
||||
print_type(numpy.ones(n, dtype=numpy.uint64).dtype)
|
||||
print_type(numpy.ones(n, dtype=numpy.double).dtype)
|
||||
- print_type(numpy.ones(n, dtype=numpy.complex).dtype)
|
||||
+ print_type(numpy.ones(n, dtype=complex).dtype)
|
||||
''',
|
||||
3,
|
||||
print_numpy_types=[int])
|
||||
--
|
||||
1.8.3.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
Name: pythran
|
||||
Version: 0.9.8^post3
|
||||
%global uver 0.9.8post3
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Ahead of Time Python compiler for numeric kernels
|
||||
|
||||
# pythran is BSD
|
||||
|
@ -20,6 +20,9 @@ Source0: %{url}/archive/%{uver}/%{name}-%{uver}.tar.gz
|
|||
# Make RNG adaptor compatible with libstdc++
|
||||
Patch1: %{url}/commit/4d317755a3b908cc.patch
|
||||
|
||||
# Compatibility with numpy 1.20, see https://github.com/serge-sans-paille/pythran/pull/1702
|
||||
Patch2: 1702.patch
|
||||
|
||||
# there is no actual arched content
|
||||
# yet we want to test on all architectures
|
||||
# and we also might need to skip some
|
||||
|
@ -39,6 +42,7 @@ BuildRequires: python3-pytest
|
|||
BuildRequires: python3-pytest-xdist
|
||||
BuildRequires: /usr/bin/python
|
||||
BuildRequires: /usr/bin/ipython
|
||||
BuildRequires: python3-scipy
|
||||
|
||||
# This is a package that compiles code, it runtime requires devel packages
|
||||
Requires: flexiblas-devel
|
||||
|
@ -108,6 +112,9 @@ rm -rf docs/_build/html/.{doctrees,buildinfo}
|
|||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 18 2021 Serge Guelton - 0.9.8^post3-2
|
||||
- Apply compatibility patch with numpy 1.20
|
||||
|
||||
* Sun Dec 13 2020 sguelton@redhat.com - 0.9.8^post3-1
|
||||
- Update to 0.9.8post3
|
||||
- No longer recommend SciPy
|
||||
|
|
Loading…
Reference in New Issue