blob: d91edda4ad1757a184016cf65e872651e1db2186 (
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
|
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/twisted/twisted-8.2.0-r2.ebuild,v 1.2 2009/10/04 20:01:14 arfrever Exp $
EAPI="2"
SUPPORT_PYTHON_ABIS="1"
inherit distutils versionator
MY_P="TwistedCore-${PV}"
DESCRIPTION="An asynchronous networking framework written in Python"
HOMEPAGE="http://www.twistedmatrix.com/"
SRC_URI="http://tmrc.mit.edu/mirror/${PN}/Core/$(get_version_component_range 1-2)/${MY_P}.tar.bz2"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
IUSE="crypt gtk serial"
DEPEND=">=dev-lang/python-2.3
>=net-zope/zope-interface-3.0.1
serial? ( dev-python/pyserial )
crypt? ( >=dev-python/pyopenssl-0.5.1 )
gtk? ( >=dev-python/pygtk-1.99 )
!dev-python/twisted-docs"
RDEPEND="${DEPEND}"
RESTRICT_PYTHON_ABIS="3*"
S="${WORKDIR}/${MY_P}"
DOCS="CREDITS NEWS README"
src_prepare(){
# Give a load-sensitive test a better chance of succeeding.
epatch "${FILESDIR}/${PN}-2.1.0-echo-less.patch"
# Pass valid arguments to "head" in the zsh completion function.
epatch "${FILESDIR}/${PN}-2.1.0-zsh-head.patch"
# Skip tests that demand non-root user
epatch "${FILESDIR}/${P}_tests.patch"
}
src_test() {
testing() {
"$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${T}/tests" --no-compile || die "Installation of tests failed with Python ${PYTHON_ABI}"
pushd "${T}/tests$(python_get_sitedir)" > /dev/null || die
# Skip tests that demand non-root user.
rm -f twisted/test/test_plugin.py
rm -f twisted/test/test_process.py
# Skip broken tests.
rm -f twisted/python/test/test_release.py
# Prevent it from pulling in plugins from already installed twisted packages.
rm -f twisted/plugins/__init__.py
# An empty file doesn't work because the tests check for
# docstrings in all packages
echo "'''plugins stub'''" > twisted/plugins/__init__.py || die
PYTHONPATH=. "${T}/tests/usr/bin/trial" twisted || die "trial failed with Python ${PYTHON_ABI}"
popd > /dev/null || die
}
python_execute_function testing
cd "${S}"
rm -rf "${T}/tests"
}
src_install() {
distutils_src_install
# get rid of this to prevent collision-protect from killing us. it
# is regenerated in pkg_postinst.
rm -f "${D}/usr/$(get_libdir)"/python*/site-packages/twisted/plugins/dropin.cache
# weird pattern to avoid installing the index.xhtml page
doman doc/man/*.?
insinto /usr/share/doc/${PF}
doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man)
newconfd "${FILESDIR}/twistd.conf" twistd
newinitd "${FILESDIR}/twistd.init" twistd
# zsh completion
insinto /usr/share/zsh/site-functions/
doins twisted/python/_twisted_zsh_stub
}
update_plugin_cache() {
local tpath="${ROOT}$(python_get_sitedir)/twisted"
# we have to remove the cache or removed plugins won't be removed
# from the cache (http://twistedmatrix.com/bugs/issue926)
[[ -e "${tpath}/plugins/dropin.cache" ]] && rm -f "${tpath}/plugins/dropin.cache"
if [[ -e "${tpath}/plugin.py" ]]; then
# twisted is still installed, update.
# we have to use getPlugIns here for <=twisted-2.0.1 compatibility
einfo "Regenerating plugin cache"
python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))"
fi
}
pkg_postinst() {
distutils_pkg_postinst
python_execute_function update_plugin_cache
}
pkg_postrm() {
distutils_pkg_postrm
python_execute_function update_plugin_cache
}
|