/[gentoo-x86]/eclass/twisted.eclass
Gentoo

Contents of /eclass/twisted.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Mon May 29 18:46:08 2006 UTC (8 years, 6 months ago) by marienz
Branch: MAIN
Changes since 1.5: +12 -1 lines
Stop the tests from breaking on up- and downgrades. Thanks to blubb for reporting.

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.5 2006/05/16 16:52:49 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 # twisted_src_test relies on the package installing twisted.names to
13 # have a ${PN} of twisted-names.
14
15 inherit distutils versionator eutils
16
17 MY_PV=${MY_PV:-${PV}}
18 MY_VERSION=$(get_version_component_range 1-2 ${MY_PV})
19 MY_P=Twisted${MY_PACKAGE}-${MY_PV}
20
21 HOMEPAGE="http://www.twistedmatrix.com/"
22 SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/${MY_VERSION}/${MY_P}.tar.bz2"
23
24 LICENSE="MIT"
25 SLOT="0"
26
27 IUSE=""
28
29 S="${WORKDIR}/${MY_P}"
30
31 twisted_src_test() {
32 python_version
33 # This is a hack to make tests work without installing to the live
34 # filesystem. We copy the twisted site-packages to a temporary
35 # dir, install there, and run from there.
36 local spath="usr/$(get_libdir)/python${PYVER}/site-packages/"
37 mkdir -p "${T}/${spath}"
38 cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die
39
40 # We have to get rid of the existing version of this package
41 # instead of just installing on top of it, since if the existing
42 # package has tests in files the version we are installing does
43 # not have we end up running fex twisted-names-0.3.0 tests when
44 # downgrading to twisted-names-0.1.0-r1.
45 rm -rf "${T}/${spath}/${PN/-//}"
46
47 if has_version ">=dev-lang/python-2.3"; then
48 "${python}" setup.py install --root="${T}" --no-compile --force \
49 --install-lib="${spath}" || die
50 else
51 "${python}" setup.py install --root="${T}" --force \
52 --install-lib="${spath}" || die
53 fi
54 cd "${T}/${spath}" || die
55 local trialopts
56 if ! has_version ">=dev-python/twisted-2.2"; then
57 trialopts=-R
58 fi
59 PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \
60 trial ${trialopts} ${PN/-/.} || die "trial failed"
61 cd "${S}"
62 rm -rf "${T}/${spath}"
63 }
64
65 twisted_src_install() {
66 python_version
67 # The explicit --install-lib here and in src_test is needed to
68 # make everything (core and all subpackages) go into lib64 on
69 # amd64. Without it pure python subpackages install into lib while
70 # stuff with c extensions goes into lib64.
71 distutils_src_install \
72 --install-lib="usr/$(get_libdir)/python${PYVER}/site-packages/"
73
74 if [[ -d doc/man ]]; then
75 doman doc/man/*
76 fi
77
78 if [[ -d doc ]]; then
79 insinto /usr/share/doc/${PF}
80 doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man)
81 fi
82 }
83
84 update_plugin_cache() {
85 einfo "Updating twisted plugin cache..."
86 python_version
87 # we have to remove the cache or removed plugins won't be removed
88 # from the cache (http://twistedmatrix.com/bugs/issue926)
89 rm "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/twisted/plugins/dropin.cache"
90 # notice we have to use getPlugIns here for <=twisted-2.0.1 compatibility
91 python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))"
92 }
93
94 twisted_pkg_postrm() {
95 distutils_pkg_postrm
96 update_plugin_cache
97 }
98
99 twisted_pkg_postinst() {
100 distutils_pkg_postinst
101 update_plugin_cache
102 }
103
104 EXPORT_FUNCTIONS src_test src_install pkg_postrm pkg_postinst

  ViewVC Help
Powered by ViewVC 1.1.20