public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pytables/, dev-python/pytables/files/
Date: Sun, 20 Jun 2021 17:38:44 +0000 (UTC)	[thread overview]
Message-ID: <1624210721.83308d078978f201c7848a90ee5a8435e6e0ab2a.mgorny@gentoo> (raw)

commit:     83308d078978f201c7848a90ee5a8435e6e0ab2a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 20 17:37:10 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jun 20 17:38:41 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83308d07

dev-python/pytables: Fix test failures with recent numpy

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/pytables-3.6.1-numpy-float.patch         | 176 +++++++++++++++++++++
 dev-python/pytables/pytables-3.6.1.ebuild          |  28 ++--
 2 files changed, 193 insertions(+), 11 deletions(-)

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
new file mode 100644
index 00000000000..71fa3b85dac
--- /dev/null
+++ b/dev-python/pytables/files/pytables-3.6.1-numpy-float.patch
@@ -0,0 +1,176 @@
+From d2a480d14f29fb1d2baee292bc6a2cca4817dcbd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
+Date: Sun, 24 Jan 2021 16:36:21 +0100
+Subject: [PATCH] Use lowercase float/int as numpy dtype
+
+Float64 is gone with numpy 1.20, which causes doctests to fail
+(https://bugzilla.redhat.com/show_bug.cgi?id=1914335).
+
+Similarly all uses of Float32, Int32 should be replaced by float32 and int32.
+
+>>> numpy.__version__
+'1.19.4'
+>>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')]
+['float16', 'Float16', 'float32', 'Float32', 'float64', 'Float64', 'float128', 'Float128', 'float_', 'float']
+
+>>> numpy.__version__
+'1.20.0rc2'
+>>> [k for k in numpy.sctypeDict.keys() if str(k).lower().startswith('float')]
+['float16', 'float32', 'float64', 'float128', 'float_', 'float']
+---
+ bench/bsddb-table-bench.py     | 10 +++++-----
+ bench/postgres-search-bench.py |  4 ++--
+ bench/pytables-search-bench.py |  6 +++---
+ bench/recarray2-test.py        |  2 +-
+ bench/shelve-bench.py          | 10 +++++-----
+ bench/sqlite-search-bench.py   |  4 ++--
+ tables/atom.py                 |  2 +-
+ 7 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/bench/bsddb-table-bench.py b/bench/bsddb-table-bench.py
+index dd9f875b..a2e02361 100644
+--- a/bench/bsddb-table-bench.py
++++ b/bench/bsddb-table-bench.py
+@@ -83,11 +83,11 @@ def createFile(filename, totalrows, recsize, verbose):
+     # Get the record object associated with the new table
+     if recsize == "big":
+         isrec = Big()
+-        arr = np.array(np.arange(32), type=np.Float64)
+-        arr2 = np.array(np.arange(32), type=np.Float64)
++        arr = np.array(np.arange(32), type=np.float64)
++        arr2 = np.array(np.arange(32), type=np.float64)
+     elif recsize == "medium":
+         isrec = Medium()
+-        arr = np.array(np.arange(2), type=np.Float64)
++        arr = np.array(np.arange(2), type=np.float64)
+     else:
+         isrec = Small()
+     # print d
+@@ -107,8 +107,8 @@ def createFile(filename, totalrows, recsize, verbose):
+             #d['TDCcount'] = i % 256
+             d['ADCcount'] = (i * 256) % (1 << 16)
+             if recsize == "big":
+-                #d.float1 = np.array([i]*32, np.Float64)
+-                #d.float2 = np.array([i**2]*32, np.Float64)
++                #d.float1 = np.array([i]*32, np.float64)
++                #d.float2 = np.array([i**2]*32, np.float64)
+                 arr[0] = 1.1
+                 d['float1'] = arr
+                 arr2[0] = 2.2
+diff --git a/bench/postgres-search-bench.py b/bench/postgres-search-bench.py
+index d2c9f4f4..7fe83f6a 100644
+--- a/bench/postgres-search-bench.py
++++ b/bench/postgres-search-bench.py
+@@ -15,11 +15,11 @@ def flatten(l):
+ 
+ 
+ def fill_arrays(start, stop):
+-    col_i = numpy.arange(start, stop, type=numpy.Int32)
++    col_i = numpy.arange(start, stop, type=numpy.int32)
+     if userandom:
+         col_j = numpy.random.uniform(0, nrows, size=[stop - start])
+     else:
+-        col_j = numpy.array(col_i, type=numpy.Float64)
++        col_j = numpy.array(col_i, type=numpy.float64)
+     return col_i, col_j
+ 
+ # Generator for ensure pytables benchmark compatibility
+diff --git a/bench/pytables-search-bench.py b/bench/pytables-search-bench.py
+index 726d30b1..6417186b 100644
+--- a/bench/pytables-search-bench.py
++++ b/bench/pytables-search-bench.py
+@@ -37,11 +37,11 @@ def create_db(filename, nrows):
+         stop = (j + 1) * step
+         if stop > nrows:
+             stop = nrows
+-        arr_f8 = np.arange(i, stop, type=np.Float64)
+-        arr_i4 = np.arange(i, stop, type=np.Int32)
++        arr_f8 = np.arange(i, stop, type=np.float64)
++        arr_i4 = np.arange(i, stop, type=np.int32)
+         if userandom:
+             arr_f8 += np.random.normal(0, stop * scale, shape=[stop - i])
+-            arr_i4 = np.array(arr_f8, type=np.Int32)
++            arr_i4 = np.array(arr_f8, type=np.int32)
+         recarr = np.rec.fromarrays([arr_i4, arr_i4, arr_f8, arr_f8])
+         table.append(recarr)
+         j += 1
+diff --git a/bench/recarray2-test.py b/bench/recarray2-test.py
+index a8602d80..bf55389d 100644
+--- a/bench/recarray2-test.py
++++ b/bench/recarray2-test.py
+@@ -22,7 +22,7 @@ delta = 0.000001
+ # Creation of recarrays objects for test
+ x1 = np.array(np.arange(reclen))
+ x2 = chararray.array(None, itemsize=7, shape=reclen)
+-x3 = np.array(np.arange(reclen, reclen * 3, 2), np.Float64)
++x3 = np.array(np.arange(reclen, reclen * 3, 2), np.float64)
+ r1 = recarray.fromarrays([x1, x2, x3], names='a,b,c')
+ r2 = recarray2.fromarrays([x1, x2, x3], names='a,b,c')
+ 
+diff --git a/bench/shelve-bench.py b/bench/shelve-bench.py
+index d30739d8..a591ed1e 100644
+--- a/bench/shelve-bench.py
++++ b/bench/shelve-bench.py
+@@ -65,8 +65,8 @@ def createFile(filename, totalrows, recsize):
+     # Get the record object associated with the new table
+     if recsize == "big":
+         d = Big()
+-        arr = NA.array(NA.arange(32), type=NA.Float64)
+-        arr2 = NA.array(NA.arange(32), type=NA.Float64)
++        arr = NA.array(NA.arange(32), type=NA.float64)
++        arr2 = NA.array(NA.arange(32), type=NA.float64)
+     elif recsize == "medium":
+         d = Medium()
+     else:
+@@ -87,15 +87,15 @@ def createFile(filename, totalrows, recsize):
+                 #d.TDCcount = i % 256
+                 d.ADCcount = (i * 256) % (1 << 16)
+                 if recsize == "big":
+-                    #d.float1 = NA.array([i]*32, NA.Float64)
+-                    #d.float2 = NA.array([i**2]*32, NA.Float64)
++                    #d.float1 = NA.array([i]*32, NA.float64)
++                    #d.float2 = NA.array([i**2]*32, NA.float64)
+                     arr[0] = 1.1
+                     d.float1 = arr
+                     arr2[0] = 2.2
+                     d.float2 = arr2
+                     pass
+                 else:
+-                    d.float1 = NA.array([i ** 2] * 2, NA.Float64)
++                    d.float1 = NA.array([i ** 2] * 2, NA.float64)
+                     #d.float1 = float(i)
+                     #d.float2 = float(i)
+                 d.grid_i = i
+diff --git a/bench/sqlite-search-bench.py b/bench/sqlite-search-bench.py
+index 76dc7c57..dc611695 100644
+--- a/bench/sqlite-search-bench.py
++++ b/bench/sqlite-search-bench.py
+@@ -136,10 +136,10 @@ CREATE INDEX ivar3 ON small(var3);
+             if randomvalues:
+                 var3 = np.random.uniform(minimum, maximum, shape=[j - i])
+             else:
+-                var3 = np.arange(i, j, type=np.Float64)
++                var3 = np.arange(i, j, type=np.float64)
+                 if noise:
+                     var3 += np.random.uniform(-3, 3, shape=[j - i])
+-            var2 = np.array(var3, type=np.Int32)
++            var2 = np.array(var3, type=np.int32)
+             var1 = np.array(None, shape=[j - i], dtype='s4')
+             if not heavy:
+                 for n in range(j - i):
+diff --git a/tables/atom.py b/tables/atom.py
+index f92e16ad..f93d915b 100644
+--- a/tables/atom.py
++++ b/tables/atom.py
+@@ -338,7 +338,7 @@ class Atom(metaclass=MetaAtom):
+             Traceback (most recent call last):
+             ...
+             ValueError: unknown NumPy scalar type: 'S5'
+-            >>> Atom.from_sctype('Float64')
++            >>> Atom.from_sctype('float64')
+             Float64Atom(shape=(), dflt=0.0)
+ 
+         """
+-- 
+2.32.0
+

diff --git a/dev-python/pytables/pytables-3.6.1.ebuild b/dev-python/pytables/pytables-3.6.1.ebuild
index 0c4f1afc0ab..b504eaf8f32 100644
--- a/dev-python/pytables/pytables-3.6.1.ebuild
+++ b/dev-python/pytables/pytables-3.6.1.ebuild
@@ -1,10 +1,9 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=7
 
-DISTUTILS_USE_SETUPTOOLS=rdepend
-PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_COMPAT=( python3_{8..9} )
 PYTHON_REQ_USE="threads(+)"
 
 MY_PN=tables
@@ -15,6 +14,7 @@ inherit distutils-r1 flag-o-matic
 DESCRIPTION="Hierarchical datasets for Python"
 HOMEPAGE="https://www.pytables.org/"
 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
 
 SLOT="0"
 KEYWORDS="amd64 ~arm ~arm64 x86 ~amd64-linux ~x86-linux"
@@ -22,26 +22,32 @@ LICENSE="BSD"
 IUSE="doc examples test"
 RESTRICT="!test? ( test )"
 
-RDEPEND="
+DEPEND="
 	app-arch/bzip2:0=
 	app-arch/lz4:0=
 	>=app-arch/zstd-1.0.0:=
 	>=dev-libs/c-blosc-1.11.1:0=
 	dev-libs/lzo:2=
 	>=dev-python/numpy-1.8.1[${PYTHON_USEDEP}]
-	>=dev-python/numexpr-2.5.2[${PYTHON_USEDEP}]
-	dev-python/six[${PYTHON_USEDEP}]
 	>=sci-libs/hdf5-1.8.15:0=
 "
-DEPEND="${RDEPEND}
+RDEPEND="${DEPEND}
+	>=dev-python/numexpr-2.5.2[${PYTHON_USEDEP}]
+	dev-python/six[${PYTHON_USEDEP}]"
+BDEPEND="
 	>=dev-python/cython-0.21[${PYTHON_USEDEP}]
-	test? ( dev-python/mock[${PYTHON_USEDEP}] )
+	test? (
+		dev-python/mock[${PYTHON_USEDEP}]
+		${RDEPEND}
+	)
 "
 
-S="${WORKDIR}/${MY_P}"
-
 DOCS=( RELEASE_NOTES.txt THANKS )
 
+PATCHES=(
+	"${FILESDIR}"/${P}-numpy-float.patch
+)
+
 python_prepare_all() {
 	export HDF5_DIR="${EPREFIX}"/usr
 	rm tables/*.c || die


             reply	other threads:[~2021-06-20 17:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20 17:38 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-11  6:26 [gentoo-commits] repo/gentoo:master commit in: dev-python/pytables/, dev-python/pytables/files/ Michał Górny
2023-04-03  1:51 Sam James
2022-12-28 15:31 Michał Górny
2021-11-20  6:44 Sam James
2017-12-04  3:30 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1624210721.83308d078978f201c7848a90ee5a8435e6e0ab2a.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox