From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1522528-garchives=archives.gentoo.org@lists.gentoo.org>
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 84C2F15806E
	for <garchives@archives.gentoo.org>; Sun, 28 May 2023 18:11:21 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 16FE4E088F;
	Sun, 28 May 2023 18:11:20 +0000 (UTC)
Received: from smtp.gentoo.org (dev.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 EC4F7E088F
	for <gentoo-commits@lists.gentoo.org>; Sun, 28 May 2023 18:11:19 +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 EA215340D55
	for <gentoo-commits@lists.gentoo.org>; Sun, 28 May 2023 18:11:18 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 45BBCA58
	for <gentoo-commits@lists.gentoo.org>; Sun, 28 May 2023 18:11:17 +0000 (UTC)
From: "Sam James" <sam@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, "Sam James" <sam@gentoo.org>
Message-ID: <1685297400.49c62a1b6a8a38d33b1f16ff035c48f3bc511f4e.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/twisted/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-python/twisted/twisted-22.10.0-r2.ebuild
X-VCS-Directories: dev-python/twisted/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 49c62a1b6a8a38d33b1f16ff035c48f3bc511f4e
X-VCS-Branch: master
Date: Sun, 28 May 2023 18:11:17 +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: b9582ff5-e513-4b17-b491-61da87785c6f
X-Archives-Hash: 2f67e2a43c0a56ab85421d1e414e7cd2

commit:     49c62a1b6a8a38d33b1f16ff035c48f3bc511f4e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat May 27 17:39:37 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun May 28 18:10:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49c62a1b

dev-python/twisted: enable py3.12, implement PYTHON_TESTED

We were using the old-fashioned scheme of XFAILing before, now we use
PYTHON_TESTED.

New revision because ~loong.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-python/twisted/twisted-22.10.0-r2.ebuild | 169 +++++++++++++++++++++++++++
 1 file changed, 169 insertions(+)

diff --git a/dev-python/twisted/twisted-22.10.0-r2.ebuild b/dev-python/twisted/twisted-22.10.0-r2.ebuild
new file mode 100644
index 000000000000..086760de159e
--- /dev/null
+++ b/dev-python/twisted/twisted-22.10.0-r2.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_TESTED=( python3_{10..11} pypy3 )
+PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" python3_12 )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1 virtualx
+
+DESCRIPTION="An asynchronous networking framework written in Python"
+HOMEPAGE="https://www.twistedmatrix.com/trac/"
+SRC_URI="
+	https://github.com/twisted/twisted/archive/${P}.tar.gz -> ${P}.gh.tar.gz
+	https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz
+"
+S=${WORKDIR}/${PN}-${P}
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+IUSE="conch http2 serial ssl test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+	>=dev-python/attrs-19.2.0[${PYTHON_USEDEP}]
+	>=dev-python/automat-0.8.0[${PYTHON_USEDEP}]
+	>=dev-python/constantly-15.1[${PYTHON_USEDEP}]
+	>=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}]
+	>=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
+	>=dev-python/typing-extensions-3.6.5[${PYTHON_USEDEP}]
+	>=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}]
+	conch? (
+		>=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
+		>=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}]
+		>=dev-python/cryptography-2.6[${PYTHON_USEDEP}]
+		dev-python/pyasn1[${PYTHON_USEDEP}]
+	)
+	http2? (
+		<dev-python/h2-5.0.0[${PYTHON_USEDEP}]
+		>=dev-python/h2-3.0.0[${PYTHON_USEDEP}]
+		<dev-python/priority-2.0[${PYTHON_USEDEP}]
+		>=dev-python/priority-1.1.0[${PYTHON_USEDEP}]
+	)
+	serial? (
+		>=dev-python/pyserial-3.0[${PYTHON_USEDEP}]
+	)
+	ssl? (
+		>=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}]
+		>=dev-python/service_identity-18.1.0[${PYTHON_USEDEP}]
+		>=dev-python/idna-2.4[${PYTHON_USEDEP}]
+	)
+"
+BDEPEND="
+	>=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
+	test? (
+		$(python_gen_cond_dep '
+			>=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
+			>=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
+			>=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}]
+			>=dev-python/idna-2.4[${PYTHON_USEDEP}]
+			dev-python/hypothesis[${PYTHON_USEDEP}]
+			dev-python/pyasn1[${PYTHON_USEDEP}]
+			>=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}]
+			>=dev-python/pyserial-3.0[${PYTHON_USEDEP}]
+			virtual/openssh
+			conch? (
+				>=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}]
+				>=dev-python/cryptography-2.6[${PYTHON_USEDEP}]
+			)
+			ssl? (
+				>=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}]
+				>=dev-python/service_identity-18.1.0[${PYTHON_USEDEP}]
+			)
+		' "${PYTHON_TESTED[@]}")
+		$(python_gen_cond_dep '
+			dev-python/gmpy[${PYTHON_USEDEP}]
+		' python3_{8..10})
+	)
+"
+
+PATCHES=(
+	# https://twistedmatrix.com/trac/ticket/10200
+	"${FILESDIR}/${PN}-22.1.0-force-gtk3.patch"
+)
+
+python_prepare_all() {
+	# upstream test for making releases; not very useful and requires
+	# sphinx (including on py2)
+	rm src/twisted/python/test/test_release.py || die
+
+	# puts system in EMFILE state, then the exception handler may fail
+	# trying to open more files due to some gi magic
+	sed -e '/SKIP_EMFILE/s:False:True:' \
+		-i src/twisted/internet/test/test_tcp.py || die
+
+	# multicast tests fail within network-sandbox
+	sed -e 's:test_joinLeave:_&:' \
+		-e 's:test_loopback:_&:' \
+		-e 's:test_multiListen:_&:' \
+		-e 's:test_multicast:_&:' \
+		-i src/twisted/test/test_udp.py || die
+
+	# These tests rely on warnings which seems work unreliably between python versions
+	sed -e 's:test_currentEUID:_&:' \
+		-e 's:test_currentUID:_&:' -i src/twisted/python/test/test_util.py || die
+
+	# broken by new expat
+	sed -e 's:test_namespaceWithWhitespace:_&:' \
+		-i src/twisted/words/test/test_domish.py || die
+
+	distutils-r1_python_prepare_all
+}
+
+src_test() {
+	# the test suite handles missing file & failing ioctl()s gracefully
+	# but not permission errors from sandbox
+	addwrite /dev/net/tun
+	virtx distutils-r1_src_test
+}
+
+python_test() {
+	if ! has "${EPYTHON}" "${PYTHON_TESTED[@]/_/.}"; then
+		einfo "Skipping tests on ${EPYTHON} (xfail)"
+		return
+	fi
+
+	"${EPYTHON}" -m twisted.trial twisted ||
+		die "Tests failed with ${EPYTHON}"
+}
+
+python_install() {
+	distutils-r1_python_install
+
+	# own the dropin.cache so we don't leave orphans
+	> "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die
+
+	python_doscript "${WORKDIR}"/twisted-regen-cache
+}
+
+python_install_all() {
+	distutils-r1_python_install_all
+
+	newconfd "${FILESDIR}/twistd.conf" twistd
+	newinitd "${FILESDIR}/twistd.init" twistd
+}
+
+python_postinst() {
+	twisted-regen-cache || die
+}
+
+pkg_postinst() {
+	if [[ -z ${ROOT} ]]; then
+		python_foreach_impl python_postinst
+	fi
+}
+
+python_postrm() {
+	rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die
+}
+
+pkg_postrm() {
+	# if we're removing the last version, remove the cache file
+	if [[ ! ${REPLACING_VERSIONS} ]]; then
+		python_foreach_impl python_postrm
+	fi
+}