summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMarien Zwart <marienz@gentoo.org>2005-11-27 20:57:36 +0000
committerMarien Zwart <marienz@gentoo.org>2005-11-27 20:57:36 +0000
commit0da2ae10c46b5d3aff941c530af9439df44bdcdc (patch)
treebc224c28e4bc7254f8fc2681d5c127e68c76a10d /eclass
parentversion bump (diff)
downloadgentoo-2-0da2ae10c46b5d3aff941c530af9439df44bdcdc.tar.gz
gentoo-2-0da2ae10c46b5d3aff941c530af9439df44bdcdc.tar.bz2
gentoo-2-0da2ae10c46b5d3aff941c530af9439df44bdcdc.zip
Add twisted.eclass for twisted subpackages (bug #80639).
Diffstat (limited to 'eclass')
-rw-r--r--eclass/twisted.eclass81
1 files changed, 81 insertions, 0 deletions
diff --git a/eclass/twisted.eclass b/eclass/twisted.eclass
new file mode 100644
index 000000000000..7346b34cf6bb
--- /dev/null
+++ b/eclass/twisted.eclass
@@ -0,0 +1,81 @@
+# Copyright 2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License, v2 or later
+# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.1 2005/11/27 20:57:36 marienz Exp $
+#
+# Author: Marien Zwart <marienz@gentoo.org>
+#
+# eclass to aid installing and testing twisted packages.
+#
+# you should set MY_PACKAGE to something like 'Names' before inheriting.
+# you may set MY_PV to the right version (defaults to PV).
+
+inherit distutils versionator
+
+MY_PV=${MY_PV:-${PV}}
+MY_VERSION=$(get_version_component_range 1-2 ${MY_PV})
+MY_P=Twisted${MY_PACKAGE}-${MY_PV}
+
+HOMEPAGE="http://www.twistedmatrix.com/"
+SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/${MY_VERSION}/${MY_P}.tar.bz2"
+
+LICENSE="MIT"
+SLOT="0"
+
+IUSE=""
+
+S="${WORKDIR}/${MY_P}"
+
+twisted_src_test() {
+ python_version
+ # This is a hack to make tests work without installing to the live
+ # filesystem. We copy the twisted site-packages to a temporary
+ # dir, install there, and run from there.
+ local spath="usr/$(get_libdir)/python${PYVER}/site-packages/"
+ mkdir -p "${T}/${spath}"
+ cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die
+ if has_version ">=dev-lang/python-2.3"; then
+ ${python} setup.py install --root="${T}" --no-compile || die
+ else
+ ${python} setup.py install --root="${T}" || die
+ fi
+ cd "${T}/${spath}" || die
+ PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \
+ trial -R ${PN/-/.} || die "trial failed"
+ cd "${S}"
+ rm -rf "${T}/${spath}"
+}
+
+twisted_src_install() {
+ distutils_src_install
+
+ if [[ -d doc/man ]]; then
+ doman doc/man/*
+ fi
+
+ if [[ -d doc ]]; then
+ insinto /usr/share/doc/${PF}
+ doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man)
+ fi
+}
+
+update_plugin_cache() {
+ einfo "Updating twisted plugin cache..."
+ python_version
+ # we have to remove the cache or removed plugins won't be removed
+ # from the cache (http://twistedmatrix.com/bugs/issue926)
+ rm "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/twisted/plugins/dropin.cache"
+ # notice we have to use getPlugIns here for <=twisted-2.0.1 compatibility
+ python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))"
+}
+
+twisted_pkg_postrm() {
+ distutils_pkg_postrm
+ update_plugin_cache
+}
+
+twisted_pkg_postinst() {
+ distutils_pkg_postinst
+ update_plugin_cache
+}
+
+EXPORT_FUNCTIONS src_test src_install pkg_postrm pkg_postinst