Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pytables/, dev-python/pytables/files/
Date: Sun, 20 Jun 2021 17:38:47
Message-Id: 1624210721.83308d078978f201c7848a90ee5a8435e6e0ab2a.mgorny@gentoo
1 commit: 83308d078978f201c7848a90ee5a8435e6e0ab2a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 20 17:37:10 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 20 17:38:41 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83308d07
7
8 dev-python/pytables: Fix test failures with recent numpy
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../files/pytables-3.6.1-numpy-float.patch | 176 +++++++++++++++++++++
13 dev-python/pytables/pytables-3.6.1.ebuild | 28 ++--
14 2 files changed, 193 insertions(+), 11 deletions(-)
15
16 diff --git a/dev-python/pytables/files/pytables-3.6.1-numpy-float.patch b/dev-python/pytables/files/pytables-3.6.1-numpy-float.patch
17 new file mode 100644
18 index 00000000000..71fa3b85dac
19 --- /dev/null
20 +++ b/dev-python/pytables/files/pytables-3.6.1-numpy-float.patch
21 @@ -0,0 +1,176 @@
22 +From d2a480d14f29fb1d2baee292bc6a2cca4817dcbd Mon Sep 17 00:00:00 2001
23 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@××××××.pl>
24 +Date: Sun, 24 Jan 2021 16:36:21 +0100
25 +Subject: [PATCH] Use lowercase float/int as numpy dtype
26 +
27 +Float64 is gone with numpy 1.20, which causes doctests to fail
28 +(https://bugzilla.redhat.com/show_bug.cgi?id=1914335).
29 +
30 +Similarly all uses of Float32, Int32 should be replaced by float32 and int32.
31 +
32 +>>> numpy.__version__
33 +'1.19.4'
34 +>>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')]
35 +['float16', 'Float16', 'float32', 'Float32', 'float64', 'Float64', 'float128', 'Float128', 'float_', 'float']
36 +
37 +>>> numpy.__version__
38 +'1.20.0rc2'
39 +>>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')]
40 +['float16', 'float32', 'float64', 'float128', 'float_', 'float']
41 +---
42 + bench/bsddb-table-bench.py | 10 +++++-----
43 + bench/postgres-search-bench.py | 4 ++--
44 + bench/pytables-search-bench.py | 6 +++---
45 + bench/recarray2-test.py | 2 +-
46 + bench/shelve-bench.py | 10 +++++-----
47 + bench/sqlite-search-bench.py | 4 ++--
48 + tables/atom.py | 2 +-
49 + 7 files changed, 19 insertions(+), 19 deletions(-)
50 +
51 +diff --git a/bench/bsddb-table-bench.py b/bench/bsddb-table-bench.py
52 +index dd9f875b..a2e02361 100644
53 +--- a/bench/bsddb-table-bench.py
54 ++++ b/bench/bsddb-table-bench.py
55 +@@ -83,11 +83,11 @@ def createFile(filename, totalrows, recsize, verbose):
56 + # Get the record object associated with the new table
57 + if recsize == "big":
58 + isrec = Big()
59 +- arr = np.array(np.arange(32), type=np.Float64)
60 +- arr2 = np.array(np.arange(32), type=np.Float64)
61 ++ arr = np.array(np.arange(32), type=np.float64)
62 ++ arr2 = np.array(np.arange(32), type=np.float64)
63 + elif recsize == "medium":
64 + isrec = Medium()
65 +- arr = np.array(np.arange(2), type=np.Float64)
66 ++ arr = np.array(np.arange(2), type=np.float64)
67 + else:
68 + isrec = Small()
69 + # print d
70 +@@ -107,8 +107,8 @@ def createFile(filename, totalrows, recsize, verbose):
71 + #d['TDCcount'] = i % 256
72 + d['ADCcount'] = (i * 256) % (1 << 16)
73 + if recsize == "big":
74 +- #d.float1 = np.array([i]*32, np.Float64)
75 +- #d.float2 = np.array([i**2]*32, np.Float64)
76 ++ #d.float1 = np.array([i]*32, np.float64)
77 ++ #d.float2 = np.array([i**2]*32, np.float64)
78 + arr[0] = 1.1
79 + d['float1'] = arr
80 + arr2[0] = 2.2
81 +diff --git a/bench/postgres-search-bench.py b/bench/postgres-search-bench.py
82 +index d2c9f4f4..7fe83f6a 100644
83 +--- a/bench/postgres-search-bench.py
84 ++++ b/bench/postgres-search-bench.py
85 +@@ -15,11 +15,11 @@ def flatten(l):
86 +
87 +
88 + def fill_arrays(start, stop):
89 +- col_i = numpy.arange(start, stop, type=numpy.Int32)
90 ++ col_i = numpy.arange(start, stop, type=numpy.int32)
91 + if userandom:
92 + col_j = numpy.random.uniform(0, nrows, size=[stop - start])
93 + else:
94 +- col_j = numpy.array(col_i, type=numpy.Float64)
95 ++ col_j = numpy.array(col_i, type=numpy.float64)
96 + return col_i, col_j
97 +
98 + # Generator for ensure pytables benchmark compatibility
99 +diff --git a/bench/pytables-search-bench.py b/bench/pytables-search-bench.py
100 +index 726d30b1..6417186b 100644
101 +--- a/bench/pytables-search-bench.py
102 ++++ b/bench/pytables-search-bench.py
103 +@@ -37,11 +37,11 @@ def create_db(filename, nrows):
104 + stop = (j + 1) * step
105 + if stop > nrows:
106 + stop = nrows
107 +- arr_f8 = np.arange(i, stop, type=np.Float64)
108 +- arr_i4 = np.arange(i, stop, type=np.Int32)
109 ++ arr_f8 = np.arange(i, stop, type=np.float64)
110 ++ arr_i4 = np.arange(i, stop, type=np.int32)
111 + if userandom:
112 + arr_f8 += np.random.normal(0, stop * scale, shape=[stop - i])
113 +- arr_i4 = np.array(arr_f8, type=np.Int32)
114 ++ arr_i4 = np.array(arr_f8, type=np.int32)
115 + recarr = np.rec.fromarrays([arr_i4, arr_i4, arr_f8, arr_f8])
116 + table.append(recarr)
117 + j += 1
118 +diff --git a/bench/recarray2-test.py b/bench/recarray2-test.py
119 +index a8602d80..bf55389d 100644
120 +--- a/bench/recarray2-test.py
121 ++++ b/bench/recarray2-test.py
122 +@@ -22,7 +22,7 @@ delta = 0.000001
123 + # Creation of recarrays objects for test
124 + x1 = np.array(np.arange(reclen))
125 + x2 = chararray.array(None, itemsize=7, shape=reclen)
126 +-x3 = np.array(np.arange(reclen, reclen * 3, 2), np.Float64)
127 ++x3 = np.array(np.arange(reclen, reclen * 3, 2), np.float64)
128 + r1 = recarray.fromarrays([x1, x2, x3], names='a,b,c')
129 + r2 = recarray2.fromarrays([x1, x2, x3], names='a,b,c')
130 +
131 +diff --git a/bench/shelve-bench.py b/bench/shelve-bench.py
132 +index d30739d8..a591ed1e 100644
133 +--- a/bench/shelve-bench.py
134 ++++ b/bench/shelve-bench.py
135 +@@ -65,8 +65,8 @@ def createFile(filename, totalrows, recsize):
136 + # Get the record object associated with the new table
137 + if recsize == "big":
138 + d = Big()
139 +- arr = NA.array(NA.arange(32), type=NA.Float64)
140 +- arr2 = NA.array(NA.arange(32), type=NA.Float64)
141 ++ arr = NA.array(NA.arange(32), type=NA.float64)
142 ++ arr2 = NA.array(NA.arange(32), type=NA.float64)
143 + elif recsize == "medium":
144 + d = Medium()
145 + else:
146 +@@ -87,15 +87,15 @@ def createFile(filename, totalrows, recsize):
147 + #d.TDCcount = i % 256
148 + d.ADCcount = (i * 256) % (1 << 16)
149 + if recsize == "big":
150 +- #d.float1 = NA.array([i]*32, NA.Float64)
151 +- #d.float2 = NA.array([i**2]*32, NA.Float64)
152 ++ #d.float1 = NA.array([i]*32, NA.float64)
153 ++ #d.float2 = NA.array([i**2]*32, NA.float64)
154 + arr[0] = 1.1
155 + d.float1 = arr
156 + arr2[0] = 2.2
157 + d.float2 = arr2
158 + pass
159 + else:
160 +- d.float1 = NA.array([i ** 2] * 2, NA.Float64)
161 ++ d.float1 = NA.array([i ** 2] * 2, NA.float64)
162 + #d.float1 = float(i)
163 + #d.float2 = float(i)
164 + d.grid_i = i
165 +diff --git a/bench/sqlite-search-bench.py b/bench/sqlite-search-bench.py
166 +index 76dc7c57..dc611695 100644
167 +--- a/bench/sqlite-search-bench.py
168 ++++ b/bench/sqlite-search-bench.py
169 +@@ -136,10 +136,10 @@ CREATE INDEX ivar3 ON small(var3);
170 + if randomvalues:
171 + var3 = np.random.uniform(minimum, maximum, shape=[j - i])
172 + else:
173 +- var3 = np.arange(i, j, type=np.Float64)
174 ++ var3 = np.arange(i, j, type=np.float64)
175 + if noise:
176 + var3 += np.random.uniform(-3, 3, shape=[j - i])
177 +- var2 = np.array(var3, type=np.Int32)
178 ++ var2 = np.array(var3, type=np.int32)
179 + var1 = np.array(None, shape=[j - i], dtype='s4')
180 + if not heavy:
181 + for n in range(j - i):
182 +diff --git a/tables/atom.py b/tables/atom.py
183 +index f92e16ad..f93d915b 100644
184 +--- a/tables/atom.py
185 ++++ b/tables/atom.py
186 +@@ -338,7 +338,7 @@ class Atom(metaclass=MetaAtom):
187 + Traceback (most recent call last):
188 + ...
189 + ValueError: unknown NumPy scalar type: 'S5'
190 +- >>> Atom.from_sctype('Float64')
191 ++ >>> Atom.from_sctype('float64')
192 + Float64Atom(shape=(), dflt=0.0)
193 +
194 + """
195 +--
196 +2.32.0
197 +
198
199 diff --git a/dev-python/pytables/pytables-3.6.1.ebuild b/dev-python/pytables/pytables-3.6.1.ebuild
200 index 0c4f1afc0ab..b504eaf8f32 100644
201 --- a/dev-python/pytables/pytables-3.6.1.ebuild
202 +++ b/dev-python/pytables/pytables-3.6.1.ebuild
203 @@ -1,10 +1,9 @@
204 -# Copyright 1999-2020 Gentoo Authors
205 +# Copyright 1999-2021 Gentoo Authors
206 # Distributed under the terms of the GNU General Public License v2
207
208 -EAPI=6
209 +EAPI=7
210
211 -DISTUTILS_USE_SETUPTOOLS=rdepend
212 -PYTHON_COMPAT=( python3_{7..9} )
213 +PYTHON_COMPAT=( python3_{8..9} )
214 PYTHON_REQ_USE="threads(+)"
215
216 MY_PN=tables
217 @@ -15,6 +14,7 @@ inherit distutils-r1 flag-o-matic
218 DESCRIPTION="Hierarchical datasets for Python"
219 HOMEPAGE="https://www.pytables.org/"
220 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
221 +S="${WORKDIR}/${MY_P}"
222
223 SLOT="0"
224 KEYWORDS="amd64 ~arm ~arm64 x86 ~amd64-linux ~x86-linux"
225 @@ -22,26 +22,32 @@ LICENSE="BSD"
226 IUSE="doc examples test"
227 RESTRICT="!test? ( test )"
228
229 -RDEPEND="
230 +DEPEND="
231 app-arch/bzip2:0=
232 app-arch/lz4:0=
233 >=app-arch/zstd-1.0.0:=
234 >=dev-libs/c-blosc-1.11.1:0=
235 dev-libs/lzo:2=
236 >=dev-python/numpy-1.8.1[${PYTHON_USEDEP}]
237 - >=dev-python/numexpr-2.5.2[${PYTHON_USEDEP}]
238 - dev-python/six[${PYTHON_USEDEP}]
239 >=sci-libs/hdf5-1.8.15:0=
240 "
241 -DEPEND="${RDEPEND}
242 +RDEPEND="${DEPEND}
243 + >=dev-python/numexpr-2.5.2[${PYTHON_USEDEP}]
244 + dev-python/six[${PYTHON_USEDEP}]"
245 +BDEPEND="
246 >=dev-python/cython-0.21[${PYTHON_USEDEP}]
247 - test? ( dev-python/mock[${PYTHON_USEDEP}] )
248 + test? (
249 + dev-python/mock[${PYTHON_USEDEP}]
250 + ${RDEPEND}
251 + )
252 "
253
254 -S="${WORKDIR}/${MY_P}"
255 -
256 DOCS=( RELEASE_NOTES.txt THANKS )
257
258 +PATCHES=(
259 + "${FILESDIR}"/${P}-numpy-float.patch
260 +)
261 +
262 python_prepare_all() {
263 export HDF5_DIR="${EPREFIX}"/usr
264 rm tables/*.c || die