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: Wed, 02 Feb 2022 09:27:26
Message-Id: 1643794003.debf3be845d789d8534b7c80ee2cc79a626a459f.mgorny@gentoo
1 commit: debf3be845d789d8534b7c80ee2cc79a626a459f
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 2 08:42:55 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 2 09:26:43 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=debf3be8
7
8 dev-python/twisted: Switch to PEP 517 build
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/twisted/twisted-21.7.0-r1.ebuild | 160 ++++++++++++++++++++++++++++
13 1 file changed, 160 insertions(+)
14
15 diff --git a/dev-python/twisted/twisted-21.7.0-r1.ebuild b/dev-python/twisted/twisted-21.7.0-r1.ebuild
16 new file mode 100644
17 index 000000000000..caadc908ddbe
18 --- /dev/null
19 +++ b/dev-python/twisted/twisted-21.7.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} )
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/gmpy[${PYTHON_USEDEP}]
81 + dev-python/idna[${PYTHON_USEDEP}]
82 + dev-python/pyasn1[${PYTHON_USEDEP}]
83 + dev-python/pyserial[${PYTHON_USEDEP}]
84 + net-misc/openssh
85 + !alpha? ( !hppa? ( !ia64? (
86 + >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}]
87 + >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
88 + dev-python/service_identity[${PYTHON_USEDEP}]
89 + ) ) )
90 + )
91 +"
92 +
93 +PATCHES=(
94 + # https://twistedmatrix.com/trac/ticket/10200
95 + "${FILESDIR}/${P}-force-gtk3.patch"
96 +)
97 +
98 +python_prepare_all() {
99 + # upstream test for making releases; not very useful and requires
100 + # sphinx (including on py2)
101 + rm src/twisted/python/test/test_release.py || die
102 +
103 + # puts system in EMFILE state, then the exception handler may fail
104 + # trying to open more files due to some gi magic
105 + sed -e '/SKIP_EMFILE/s:False:True:' \
106 + -i src/twisted/internet/test/test_tcp.py || die
107 +
108 + # multicast tests fail within network-sandbox
109 + sed -e 's:test_joinLeave:_&:' \
110 + -e 's:test_loopback:_&:' \
111 + -e 's:test_multiListen:_&:' \
112 + -e 's:test_multicast:_&:' \
113 + -i src/twisted/test/test_udp.py || die
114 +
115 + # accesses /dev/net/tun
116 + sed -e '/class RealDeviceTestsMixin/a\
117 + skip = "Requires extra permissions"' \
118 + -i src/twisted/pair/test/test_tuntap.py || die
119 +
120 + # These tests rely on warnings which seems work unreliably between python versions
121 + sed -e 's:test_currentEUID:_&:' \
122 + -e 's:test_currentUID:_&:' -i src/twisted/python/test/test_util.py || die
123 +
124 + distutils-r1_python_prepare_all
125 +}
126 +
127 +src_test() {
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 + touch "${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 +}