| 1 |
# Copyright 2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License, v2 or later
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.1 2005/11/27 20:57:36 marienz Exp $
|
| 4 |
#
|
| 5 |
# Author: Marien Zwart <marienz@gentoo.org>
|
| 6 |
#
|
| 7 |
# eclass to aid installing and testing twisted packages.
|
| 8 |
#
|
| 9 |
# you should set MY_PACKAGE to something like 'Names' before inheriting.
|
| 10 |
# you may set MY_PV to the right version (defaults to PV).
|
| 11 |
|
| 12 |
inherit distutils versionator
|
| 13 |
|
| 14 |
MY_PV=${MY_PV:-${PV}}
|
| 15 |
MY_VERSION=$(get_version_component_range 1-2 ${MY_PV})
|
| 16 |
MY_P=Twisted${MY_PACKAGE}-${MY_PV}
|
| 17 |
|
| 18 |
HOMEPAGE="http://www.twistedmatrix.com/"
|
| 19 |
SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/${MY_VERSION}/${MY_P}.tar.bz2"
|
| 20 |
|
| 21 |
LICENSE="MIT"
|
| 22 |
SLOT="0"
|
| 23 |
|
| 24 |
IUSE=""
|
| 25 |
|
| 26 |
S="${WORKDIR}/${MY_P}"
|
| 27 |
|
| 28 |
twisted_src_test() {
|
| 29 |
python_version
|
| 30 |
# This is a hack to make tests work without installing to the live
|
| 31 |
# filesystem. We copy the twisted site-packages to a temporary
|
| 32 |
# dir, install there, and run from there.
|
| 33 |
local spath="usr/$(get_libdir)/python${PYVER}/site-packages/"
|
| 34 |
mkdir -p "${T}/${spath}"
|
| 35 |
cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die
|
| 36 |
if has_version ">=dev-lang/python-2.3"; then
|
| 37 |
${python} setup.py install --root="${T}" --no-compile || die
|
| 38 |
else
|
| 39 |
${python} setup.py install --root="${T}" || die
|
| 40 |
fi
|
| 41 |
cd "${T}/${spath}" || die
|
| 42 |
PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \
|
| 43 |
trial -R ${PN/-/.} || die "trial failed"
|
| 44 |
cd "${S}"
|
| 45 |
rm -rf "${T}/${spath}"
|
| 46 |
}
|
| 47 |
|
| 48 |
twisted_src_install() {
|
| 49 |
distutils_src_install
|
| 50 |
|
| 51 |
if [[ -d doc/man ]]; then
|
| 52 |
doman doc/man/*
|
| 53 |
fi
|
| 54 |
|
| 55 |
if [[ -d doc ]]; then
|
| 56 |
insinto /usr/share/doc/${PF}
|
| 57 |
doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man)
|
| 58 |
fi
|
| 59 |
}
|
| 60 |
|
| 61 |
update_plugin_cache() {
|
| 62 |
einfo "Updating twisted plugin cache..."
|
| 63 |
python_version
|
| 64 |
# we have to remove the cache or removed plugins won't be removed
|
| 65 |
# from the cache (http://twistedmatrix.com/bugs/issue926)
|
| 66 |
rm "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/twisted/plugins/dropin.cache"
|
| 67 |
# notice we have to use getPlugIns here for <=twisted-2.0.1 compatibility
|
| 68 |
python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))"
|
| 69 |
}
|
| 70 |
|
| 71 |
twisted_pkg_postrm() {
|
| 72 |
distutils_pkg_postrm
|
| 73 |
update_plugin_cache
|
| 74 |
}
|
| 75 |
|
| 76 |
twisted_pkg_postinst() {
|
| 77 |
distutils_pkg_postinst
|
| 78 |
update_plugin_cache
|
| 79 |
}
|
| 80 |
|
| 81 |
EXPORT_FUNCTIONS src_test src_install pkg_postrm pkg_postinst
|