blob: 073a66157ff629cc47b7848a9b61b291d74a377b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_USE_PEP517=hatchling
PYTHON_TESTED=( python3_{10..12} pypy3 )
PYTHON_COMPAT=( "${PYTHON_TESTED[@]}" )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1 pypi virtualx
DESCRIPTION="An asynchronous networking framework written in Python"
HOMEPAGE="
https://twisted.org/
https://github.com/twisted/twisted/
https://pypi.org/project/Twisted/
"
SRC_URI+="
https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~arm64-macos ~x64-macos"
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-22.10.0[${PYTHON_USEDEP}]
>=dev-python/typing-extensions-4.2.0[${PYTHON_USEDEP}]
>=dev-python/zope-interface-5[${PYTHON_USEDEP}]
conch? (
>=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
>=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}]
>=dev-python/cryptography-3.3[${PYTHON_USEDEP}]
dev-python/pyasn1[${PYTHON_USEDEP}]
)
http2? (
<dev-python/h2-5.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/hatch-fancy-pypi-readme-22.5.0[${PYTHON_USEDEP}]
>=dev-python/incremental-22.10.0[${PYTHON_USEDEP}]
test? (
${RDEPEND}
$(python_gen_cond_dep '
>=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
>=dev-python/bcrypt-3.0.0[${PYTHON_USEDEP}]
>=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
<dev-python/cython-test-exception-raiser-2[${PYTHON_USEDEP}]
>=dev-python/cython-test-exception-raiser-1.0.2[${PYTHON_USEDEP}]
>=dev-python/idna-2.4[${PYTHON_USEDEP}]
>=dev-python/hypothesis-6.56[${PYTHON_USEDEP}]
dev-python/pyasn1[${PYTHON_USEDEP}]
>=dev-python/pyhamcrest-2[${PYTHON_USEDEP}]
>=dev-python/pyserial-3.0[${PYTHON_USEDEP}]
virtual/openssh
ssl? (
>=dev-python/pyopenssl-21.0.0[${PYTHON_USEDEP}]
>=dev-python/service-identity-18.1.0[${PYTHON_USEDEP}]
)
' "${PYTHON_TESTED[@]}")
)
"
PATCHES=(
"${FILESDIR}/${PN}-24.3.0-skip-dsa-tests.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
# 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
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
# breaks some tests by overriding empty environment
local -x SANDBOX_ON=0
"${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
}
|