From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1213168-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id C5597138359
	for <garchives@archives.gentoo.org>; Fri,  9 Oct 2020 12:43:22 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 03706E0809;
	Fri,  9 Oct 2020 12:43:22 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DD4FCE0809
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Oct 2020 12:43:21 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 9BD5C340F89
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Oct 2020 12:43:20 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1FE42332
	for <gentoo-commits@lists.gentoo.org>; Fri,  9 Oct 2020 12:43:19 +0000 (UTC)
From: "Louis Sautier" <sbraz@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Louis Sautier" <sbraz@gentoo.org>
Message-ID: <1602247390.4ac7b9cd6b2631631d250b7c618d43f484e3dd63.sbraz@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/lmdb/, dev-python/lmdb/files/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch dev-python/lmdb/lmdb-1.0.0.ebuild
X-VCS-Directories: dev-python/lmdb/files/ dev-python/lmdb/
X-VCS-Committer: sbraz
X-VCS-Committer-Name: Louis Sautier
X-VCS-Revision: 4ac7b9cd6b2631631d250b7c618d43f484e3dd63
X-VCS-Branch: master
Date: Fri,  9 Oct 2020 12:43:19 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 4e1e14dd-498d-4c4f-addf-b5d335f2b787
X-Archives-Hash: 767c3a0b77026c8493f6ba9849a98a1f

commit:     4ac7b9cd6b2631631d250b7c618d43f484e3dd63
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 12:39:57 2020 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 12:43:10 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ac7b9cd

dev-python/lmdb: add PyPy3 support

Package-Manager: Portage-3.0.8, Repoman-3.0.1
Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 dev-python/lmdb/files/lmdb-1.0.0-pypy3.patch | 40 ++++++++++++++++++++++++++++
 dev-python/lmdb/lmdb-1.0.0.ebuild            | 14 +++++++---
 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 00000000000..008213ac46c
--- /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 c96b90dc4e1..8801f1e8235 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_{6..9} )
+PYTHON_COMPAT=( pypy3 python3_{6..9} )
 
 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
+}