summaryrefslogtreecommitdiff
path: root/dev-python
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch40
-rw-r--r--dev-python/lmdb/lmdb-1.0.0.ebuild14
2 files changed, 51 insertions, 3 deletions
diff --git a/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch b/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch
new file mode 100644
index 000000000000..008213ac46c6
--- /dev/null
+++ b/dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch
@@ -0,0 +1,40 @@
+From 2d0f93984f53c19925f07d742584f5e3e69d7902 Mon Sep 17 00:00:00 2001
+From: Nic Watson <github@nicwatson.org>
+Date: Wed, 7 Oct 2020 12:44:30 -0400
+Subject: [PATCH] Get pypy3 passing tests
+
+---
+ .travis.yml | 2 +-
+ tests/cursor_test.py | 8 ++++----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/tests/cursor_test.py b/tests/cursor_test.py
+index acfb0ea..22dd6f8 100644
+--- a/tests/cursor_test.py
++++ b/tests/cursor_test.py
+@@ -245,7 +245,7 @@ def setUp(self, redo=False):
+ self.txn = self.env.begin(write=True)
+ self.c = self.txn.cursor()
+
+- @unittest.skipIf(sys.platform != 'linux', "test only works on Linux")
++ @unittest.skipIf(not sys.platform.startswith('linux'), "test only works on Linux")
+ def test_preload(self):
+ """
+ Test that reading just the key doesn't prefault the value contents, but
+@@ -264,13 +264,13 @@ def test_preload(self):
+ self.path, self.env = testlib.temp_env(path=self.path, writemap=True)
+ self.txn = self.env.begin(write=True, buffers=True)
+ self.c = self.txn.cursor()
+- minflts_before = resource.getrusage(resource.RUSAGE_THREAD)[6]
++ minflts_before = resource.getrusage(resource.RUSAGE_SELF)[6]
+ self.c.set_key(B('a'))
+ assert self.c.key() == B('a')
+- minflts_after_key = resource.getrusage(resource.RUSAGE_THREAD)[6]
++ minflts_after_key = resource.getrusage(resource.RUSAGE_SELF)[6]
+
+ self.c.value()
+- minflts_after_value = resource.getrusage(resource.RUSAGE_THREAD)[6]
++ minflts_after_value = resource.getrusage(resource.RUSAGE_SELF)[6]
+
+ epsilon = 20
+
diff --git a/dev-python/lmdb/lmdb-1.0.0.ebuild b/dev-python/lmdb/lmdb-1.0.0.ebuild
index 37d948c5af0a..7c5e8e2888de 100644
--- a/dev-python/lmdb/lmdb-1.0.0.ebuild
+++ b/dev-python/lmdb/lmdb-1.0.0.ebuild
@@ -3,9 +3,7 @@
EAPI=7
-# TODO: add PyPy3 when it is supported
-# https://github.com/jnwatson/py-lmdb/issues/260
-PYTHON_COMPAT=( python3_{5,6,7,8,9} )
+PYTHON_COMPAT=( python3_{5,6,7,8,9} pypy3 )
inherit distutils-r1
@@ -23,6 +21,11 @@ DEPEND="${RDEPEND}"
distutils_enable_sphinx docs
distutils_enable_tests pytest
+PATCHES=(
+ # https://github.com/jnwatson/py-lmdb/commit/2d0f93984f53c19925f07d742584f5e3e69d7902
+ "${FILESDIR}/${P}-pypy3.patch"
+)
+
python_compile() {
LMDB_FORCE_SYSTEM=1 distutils-r1_python_compile
}
@@ -30,3 +33,8 @@ python_compile() {
python_test() {
pytest tests -vv || die "Tests fail with ${EPYTHON}"
}
+
+python_install() {
+ # This is required when the CFFI extension is used (for PyPy3)
+ LMDB_FORCE_SYSTEM=1 distutils-r1_python_install
+}