Gentoo Archives: gentoo-commits

From: Louis Sautier <sbraz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/lmdb/, dev-python/lmdb/files/
Date: Fri, 09 Oct 2020 12:43:22
Message-Id: 1602247390.4ac7b9cd6b2631631d250b7c618d43f484e3dd63.sbraz@gentoo
1 commit: 4ac7b9cd6b2631631d250b7c618d43f484e3dd63
2 Author: Louis Sautier <sbraz <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 9 12:39:57 2020 +0000
4 Commit: Louis Sautier <sbraz <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 9 12:43:10 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ac7b9cd
7
8 dev-python/lmdb: add PyPy3 support
9
10 Package-Manager: Portage-3.0.8, Repoman-3.0.1
11 Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>
12
13 dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch | 40 ++++++++++++++++++++++++++++
14 dev-python/lmdb/lmdb-1.0.0.ebuild | 14 +++++++---
15 2 files changed, 51 insertions(+), 3 deletions(-)
16
17 diff --git a/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch b/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch
18 new file mode 100644
19 index 00000000000..008213ac46c
20 --- /dev/null
21 +++ b/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch
22 @@ -0,0 +1,40 @@
23 +From 2d0f93984f53c19925f07d742584f5e3e69d7902 Mon Sep 17 00:00:00 2001
24 +From: Nic Watson <github@×××××××××.org>
25 +Date: Wed, 7 Oct 2020 12:44:30 -0400
26 +Subject: [PATCH] Get pypy3 passing tests
27 +
28 +---
29 + .travis.yml | 2 +-
30 + tests/cursor_test.py | 8 ++++----
31 + 2 files changed, 5 insertions(+), 5 deletions(-)
32 +
33 +diff --git a/tests/cursor_test.py b/tests/cursor_test.py
34 +index acfb0ea..22dd6f8 100644
35 +--- a/tests/cursor_test.py
36 ++++ b/tests/cursor_test.py
37 +@@ -245,7 +245,7 @@ def setUp(self, redo=False):
38 + self.txn = self.env.begin(write=True)
39 + self.c = self.txn.cursor()
40 +
41 +- @unittest.skipIf(sys.platform != 'linux', "test only works on Linux")
42 ++ @unittest.skipIf(not sys.platform.startswith('linux'), "test only works on Linux")
43 + def test_preload(self):
44 + """
45 + Test that reading just the key doesn't prefault the value contents, but
46 +@@ -264,13 +264,13 @@ def test_preload(self):
47 + self.path, self.env = testlib.temp_env(path=self.path, writemap=True)
48 + self.txn = self.env.begin(write=True, buffers=True)
49 + self.c = self.txn.cursor()
50 +- minflts_before = resource.getrusage(resource.RUSAGE_THREAD)[6]
51 ++ minflts_before = resource.getrusage(resource.RUSAGE_SELF)[6]
52 + self.c.set_key(B('a'))
53 + assert self.c.key() == B('a')
54 +- minflts_after_key = resource.getrusage(resource.RUSAGE_THREAD)[6]
55 ++ minflts_after_key = resource.getrusage(resource.RUSAGE_SELF)[6]
56 +
57 + self.c.value()
58 +- minflts_after_value = resource.getrusage(resource.RUSAGE_THREAD)[6]
59 ++ minflts_after_value = resource.getrusage(resource.RUSAGE_SELF)[6]
60 +
61 + epsilon = 20
62 +
63
64 diff --git a/dev-python/lmdb/lmdb-1.0.0.ebuild b/dev-python/lmdb/lmdb-1.0.0.ebuild
65 index c96b90dc4e1..8801f1e8235 100644
66 --- a/dev-python/lmdb/lmdb-1.0.0.ebuild
67 +++ b/dev-python/lmdb/lmdb-1.0.0.ebuild
68 @@ -3,9 +3,7 @@
69
70 EAPI=7
71
72 -# TODO: add PyPy3 when it is supported
73 -# https://github.com/jnwatson/py-lmdb/issues/260
74 -PYTHON_COMPAT=( python3_{6..9} )
75 +PYTHON_COMPAT=( pypy3 python3_{6..9} )
76
77 inherit distutils-r1
78
79 @@ -23,6 +21,11 @@ DEPEND="${RDEPEND}"
80 distutils_enable_sphinx docs
81 distutils_enable_tests pytest
82
83 +PATCHES=(
84 + # https://github.com/jnwatson/py-lmdb/commit/2d0f93984f53c19925f07d742584f5e3e69d7902
85 + "${FILESDIR}/${P}-pypy3.patch"
86 +)
87 +
88 python_compile() {
89 LMDB_FORCE_SYSTEM=1 distutils-r1_python_compile
90 }
91 @@ -30,3 +33,8 @@ python_compile() {
92 python_test() {
93 pytest tests -vv || die "Tests fail with ${EPYTHON}"
94 }
95 +
96 +python_install() {
97 + # This is required when the CFFI extension is used (for PyPy3)
98 + LMDB_FORCE_SYSTEM=1 distutils-r1_python_install
99 +}