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/csv23/files/, dev-python/csv23/
Date: Thu, 30 Apr 2020 11:06:47
Message-Id: 1588244763.2c9b1b95cbd96a043d376521e5a245791db11a13.mgorny@gentoo
1 commit: 2c9b1b95cbd96a043d376521e5a245791db11a13
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Apr 30 10:48:01 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 30 11:06:03 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c9b1b95
7
8 dev-python/csv23: Fix pypy3 compat
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/csv23/csv23-0.3.ebuild | 6 +++-
13 dev-python/csv23/files/csv23-0.3-pypy3.patch | 44 ++++++++++++++++++++++++++++
14 2 files changed, 49 insertions(+), 1 deletion(-)
15
16 diff --git a/dev-python/csv23/csv23-0.3.ebuild b/dev-python/csv23/csv23-0.3.ebuild
17 index 4bb3e2569a8..82aab4ad628 100644
18 --- a/dev-python/csv23/csv23-0.3.ebuild
19 +++ b/dev-python/csv23/csv23-0.3.ebuild
20 @@ -3,7 +3,7 @@
21
22 EAPI=7
23
24 -PYTHON_COMPAT=( python{2_7,3_{6,7,8}} )
25 +PYTHON_COMPAT=( python{2_7,3_{6,7,8}} pypy3 )
26 inherit distutils-r1
27
28 DESCRIPTION="Python 2/3 unicode CSV compatibility layer"
29 @@ -24,6 +24,10 @@ BDEPEND="
30
31 distutils_enable_tests pytest
32
33 +PATCHES=(
34 + "${FILESDIR}"/${P}-pypy3.patch
35 +)
36 +
37 src_prepare() {
38 sed -i -e '/--cov/d' setup.cfg || die
39 distutils-r1_src_prepare
40
41 diff --git a/dev-python/csv23/files/csv23-0.3-pypy3.patch b/dev-python/csv23/files/csv23-0.3-pypy3.patch
42 new file mode 100644
43 index 00000000000..2e1e3b217c2
44 --- /dev/null
45 +++ b/dev-python/csv23/files/csv23-0.3-pypy3.patch
46 @@ -0,0 +1,44 @@
47 +From cb9a4519b81daccbb54ea767829d888a6b97855a Mon Sep 17 00:00:00 2001
48 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
49 +Date: Thu, 30 Apr 2020 11:54:31 +0200
50 +Subject: [PATCH] fix hashlib usage compatibility with pypy3
51 +
52 +PyPy3's hashlib fails when passed a memoryview object (i.e.
53 +BytesIO.getbuffer()). Convert it to bytes instead in order to fix
54 +compatibility. While this isn't necessary for CPython, it should not
55 +cause any issues.
56 +
57 +Also enabling testing with pypy3. I had to switch to the newer Ubuntu
58 +version as well in order to avoid more bugs in old PyPy versions.
59 +
60 +PyPy3 bug: https://foss.heptapod.net/pypy/pypy/issues/3217
61 +---
62 + .travis.yml | 2 ++
63 + csv23/shortcuts.py | 2 +-
64 + tox.ini | 2 +-
65 + 3 files changed, 4 insertions(+), 2 deletions(-)
66 +
67 +diff --git a/csv23/shortcuts.py b/csv23/shortcuts.py
68 +index 6eeb248..7bdb013 100644
69 +--- a/csv23/shortcuts.py
70 ++++ b/csv23/shortcuts.py
71 +@@ -206,7 +206,7 @@ def write_csv(file, rows, header=None, dialect=DIALECT, encoding=ENCODING,
72 + buf = f.buffer
73 + for rows in iterslices(rows, 1000):
74 + writer.writerows(rows)
75 +- hashsum.update(buf.getbuffer())
76 ++ hashsum.update(bytes(buf.getbuffer()))
77 + # NOTE: f.truncate(0) would prepend zero-bytes
78 + f.seek(0)
79 + f.truncate()
80 +diff --git a/tox.ini b/tox.ini
81 +index 2a234b3..89a4432 100644
82 +--- a/tox.ini
83 ++++ b/tox.ini
84 +@@ -1,5 +1,5 @@
85 + [tox]
86 +-envlist = py{27,35,36,37,38}
87 ++envlist = py{27,35,36,37,38},pypy3
88 + skip_missing_interpreters = true
89 +
90 + [testenv]