From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E71A715838C for ; Sat, 27 Jan 2024 20:33:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35D2DE29E2; Sat, 27 Jan 2024 20:33:26 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E7852E29DD for ; Sat, 27 Jan 2024 20:33:25 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 26D7E3432BA for ; Sat, 27 Jan 2024 20:33:25 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 836B21065 for ; Sat, 27 Jan 2024 20:33:23 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1706387584.de35fc5dbc38e4d0b493520b2a3296fb991dc09d.mgorny@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/psycopg/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/psycopg/psycopg-3.1.17.ebuild X-VCS-Directories: dev-python/psycopg/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: de35fc5dbc38e4d0b493520b2a3296fb991dc09d X-VCS-Branch: master Date: Sat, 27 Jan 2024 20:33:23 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 00d3df6b-eb27-4c84-af45-6667e37b9bd0 X-Archives-Hash: f5c99b4b8387009275fdc54540c23f09 commit: de35fc5dbc38e4d0b493520b2a3296fb991dc09d Author: Michał Górny gentoo org> AuthorDate: Sat Jan 27 15:01:04 2024 +0000 Commit: Michał Górny gentoo org> CommitDate: Sat Jan 27 20:33:04 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de35fc5d dev-python/psycopg: Support building the C backend Signed-off-by: Michał Górny gentoo.org> dev-python/psycopg/psycopg-3.1.17.ebuild | 45 +++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/dev-python/psycopg/psycopg-3.1.17.ebuild b/dev-python/psycopg/psycopg-3.1.17.ebuild index 5dc95f268c32..70302101bce9 100644 --- a/dev-python/psycopg/psycopg-3.1.17.ebuild +++ b/dev-python/psycopg/psycopg-3.1.17.ebuild @@ -3,6 +3,7 @@ EAPI=8 +DISTUTILS_EXT=1 DISTUTILS_USE_PEP517=setuptools PYTHON_COMPAT=( pypy3 python3_{10..12} ) @@ -18,20 +19,29 @@ SRC_URI=" https://github.com/psycopg/psycopg/archive/${PV}.tar.gz -> ${P}.gh.tar.gz " -S=${WORKDIR}/${P}/psycopg LICENSE="LGPL-3+" SLOT="0" KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~riscv ~s390 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="+native-extensions" DEPEND=" - >=dev-db/postgresql-8.1:* + native-extensions? ( + >=dev-db/postgresql-8.1:= + ) + !native-extensions? ( + >=dev-db/postgresql-8.1:* + ) " RDEPEND=" ${DEPEND} >=dev-python/typing-extensions-4.1[${PYTHON_USEDEP}] " BDEPEND=" + native-extensions? ( + dev-python/cython[${PYTHON_USEDEP}] + dev-python/tomli[${PYTHON_USEDEP}] + ) test? ( >=dev-db/postgresql-8.1[server] dev-python/anyio[${PYTHON_USEDEP}] @@ -41,9 +51,22 @@ BDEPEND=" distutils_enable_tests pytest -src_test() { - # tests are lurking in top-level directory +python_compile() { + # Python code + ctypes backend + cd psycopg || die + distutils-r1_python_compile + + # optional C backend + if use native-extensions && [[ ${EPYTHON} != pypy3 ]]; then + local DISTUTILS_USE_PEP517=standalone + cd ../psycopg_c || die + distutils-r1_python_compile + fi cd .. || die +} + +src_test() { + rm -r psycopg{,_c} || die initdb -D "${T}"/pgsql || die # TODO: random port @@ -70,7 +93,17 @@ python_test() { tests/test_dns_srv.py::test_srv ) + local impls=( python ) + if use native-extensions && [[ ${EPYTHON} != pypy3 ]]; then + impls+=( c ) + fi + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 - # leak and timing tests are fragile whereas slow tests are slow - epytest -p anyio -k "not leak" -m "not timing and not slow" + local -x PSYCOPG_IMPL + for PSYCOPG_IMPL in "${impls[@]}"; do + einfo "Testing with ${PSYCOPG_IMPL} implementation ..." + # leak and timing tests are fragile whereas slow tests are slow + epytest -p anyio -k "not leak" \ + -m "not timing and not slow and not flakey" + done }