Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/twisted/
Date: Tue, 08 Feb 2022 12:08:52
Message-Id: 1644320733.7102cd3c327a87f118b51cd6b01f0094c50249e4.mgorny@gentoo
1 commit: 7102cd3c327a87f118b51cd6b01f0094c50249e4
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 8 11:45:33 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 8 11:45:33 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7102cd3c
7
8 dev-python/twisted: Add a PEP517/pypy3 22.1.0-r1
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/twisted/twisted-22.1.0-r1.ebuild | 160 ++++++++++++++++++++++++++++
13 1 file changed, 160 insertions(+)
14
15 diff --git a/dev-python/twisted/twisted-22.1.0-r1.ebuild b/dev-python/twisted/twisted-22.1.0-r1.ebuild
16 new file mode 100644
17 index 000000000000..270ad15805d4
18 --- /dev/null
19 +++ b/dev-python/twisted/twisted-22.1.0-r1.ebuild
20 @@ -0,0 +1,160 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +DISTUTILS_USE_PEP517=setuptools
27 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
28 +PYTHON_REQ_USE="threads(+)"
29 +
30 +inherit distutils-r1 virtualx
31 +
32 +DESCRIPTION="An asynchronous networking framework written in Python"
33 +HOMEPAGE="https://www.twistedmatrix.com/trac/"
34 +SRC_URI="
35 + https://github.com/twisted/twisted/archive/${P}.tar.gz
36 + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz"
37 +S=${WORKDIR}/${PN}-${P}
38 +
39 +LICENSE="MIT"
40 +SLOT="0"
41 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
42 +IUSE="conch crypt http2 serial test"
43 +RESTRICT="!test? ( test )"
44 +
45 +RDEPEND="
46 + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}]
47 + >=dev-python/automat-0.3.0[${PYTHON_USEDEP}]
48 + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
49 + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}]
50 + >=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
51 + >=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}]
52 + >=dev-python/typing-extensions-3.6.5[${PYTHON_USEDEP}]
53 + >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}]
54 + conch? (
55 + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
56 + dev-python/bcrypt[${PYTHON_USEDEP}]
57 + >=dev-python/cryptography-1.5.0[${PYTHON_USEDEP}]
58 + dev-python/pyasn1[${PYTHON_USEDEP}]
59 + )
60 + crypt? (
61 + >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
62 + dev-python/service_identity[${PYTHON_USEDEP}]
63 + >=dev-python/idna-0.6[${PYTHON_USEDEP}]
64 + )
65 + serial? ( >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] )
66 + http2? (
67 + >=dev-python/h2-3.0.0[${PYTHON_USEDEP}]
68 + <dev-python/h2-4.0.0[${PYTHON_USEDEP}]
69 + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}]
70 + <dev-python/priority-2.0[${PYTHON_USEDEP}]
71 + )
72 +"
73 +BDEPEND="
74 + >=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
75 + test? (
76 + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
77 + dev-python/bcrypt[${PYTHON_USEDEP}]
78 + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
79 + dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}]
80 + dev-python/idna[${PYTHON_USEDEP}]
81 + dev-python/pyasn1[${PYTHON_USEDEP}]
82 + dev-python/pyserial[${PYTHON_USEDEP}]
83 + net-misc/openssh
84 + $(python_gen_cond_dep '
85 + dev-python/gmpy[${PYTHON_USEDEP}]
86 + ' 'python*')
87 + !alpha? ( !hppa? ( !ia64? (
88 + >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}]
89 + >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
90 + dev-python/service_identity[${PYTHON_USEDEP}]
91 + ) ) )
92 + )
93 +"
94 +
95 +PATCHES=(
96 + # https://twistedmatrix.com/trac/ticket/10200
97 + "${FILESDIR}/${P}-force-gtk3.patch"
98 +)
99 +
100 +python_prepare_all() {
101 + # upstream test for making releases; not very useful and requires
102 + # sphinx (including on py2)
103 + rm src/twisted/python/test/test_release.py || die
104 +
105 + # puts system in EMFILE state, then the exception handler may fail
106 + # trying to open more files due to some gi magic
107 + sed -e '/SKIP_EMFILE/s:False:True:' \
108 + -i src/twisted/internet/test/test_tcp.py || die
109 +
110 + # multicast tests fail within network-sandbox
111 + sed -e 's:test_joinLeave:_&:' \
112 + -e 's:test_loopback:_&:' \
113 + -e 's:test_multiListen:_&:' \
114 + -e 's:test_multicast:_&:' \
115 + -i src/twisted/test/test_udp.py || die
116 +
117 + # These tests rely on warnings which seems work unreliably between python versions
118 + sed -e 's:test_currentEUID:_&:' \
119 + -e 's:test_currentUID:_&:' -i src/twisted/python/test/test_util.py || die
120 +
121 + distutils-r1_python_prepare_all
122 +}
123 +
124 +src_test() {
125 + # the test suite handles missing file & failing ioctl()s gracefully
126 + # but not permission errors from sandbox
127 + addwrite /dev/net/tun
128 + virtx distutils-r1_src_test
129 +}
130 +
131 +python_test() {
132 + "${EPYTHON}" -m twisted.trial twisted ||
133 + die "Tests failed with ${EPYTHON}"
134 +}
135 +
136 +python_install() {
137 + distutils-r1_python_install
138 +
139 + # own the dropin.cache so we don't leave orphans
140 + > "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die
141 +
142 + python_doscript "${WORKDIR}"/twisted-regen-cache
143 +}
144 +
145 +python_install_all() {
146 + distutils-r1_python_install_all
147 +
148 + newconfd "${FILESDIR}/twistd.conf" twistd
149 + newinitd "${FILESDIR}/twistd.init" twistd
150 +}
151 +
152 +python_postinst() {
153 + twisted-regen-cache || die
154 +}
155 +
156 +pkg_postinst() {
157 + python_foreach_impl python_postinst
158 +
159 + einfo "Install complete"
160 + if use test ; then
161 + einfo ""
162 + einfo "Some tests have been disabled during testing due to"
163 + einfo "known incompatibilities with the emerge sandboxes and/or"
164 + einfo "not runnable as the root user."
165 + einfo "For a complete test suite run on the code."
166 + einfo "Run the tests as a normal user for each python it is installed to."
167 + einfo " ie: $ python3.6 /usr/bin/trial twisted"
168 + fi
169 +}
170 +
171 +python_postrm() {
172 + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die
173 +}
174 +
175 +pkg_postrm() {
176 + # if we're removing the last version, remove the cache file
177 + if [[ ! ${REPLACING_VERSIONS} ]]; then
178 + python_foreach_impl python_postrm
179 + fi
180 +}