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

Contents of /eclass/twisted.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Fri Nov 21 01:55:45 2014 UTC (5 weeks, 2 days ago) by floppym
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
FILE REMOVED
Remove unused eclass.

1 # Copyright 1999-2014 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.11 2014/11/20 15:32:09 mgorny Exp $
4
5 # @ECLASS: twisted.eclass
6 # @MAINTAINER:
7 # Gentoo Python Project <python@gentoo.org>
8 # @BLURB: Eclass for Twisted packages
9 # @DESCRIPTION:
10 # The twisted eclass defines phase functions for Twisted packages.
11 #
12 # The following variables can be set in dev-python/twisted* packages before inheriting this eclass:
13 # MY_PACKAGE - Package name suffix (required)
14 # MY_PV - Package version (optional)
15 #
16 # This eclass is DEPRECATED. Please use twisted-r1 instead.
17
18 inherit distutils versionator
19
20 EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
21
22 if [[ "${CATEGORY}/${PN}" == "dev-python/twisted"* ]]; then
23 EXPORT_FUNCTIONS src_test
24
25 MY_PV="${MY_PV:-${PV}}"
26 MY_P="Twisted${MY_PACKAGE}-${MY_PV}"
27
28 HOMEPAGE="http://www.twistedmatrix.com/"
29 #SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/$(get_version_component_range 1-2 ${MY_PV})/${MY_P}.tar.bz2"
30 SRC_URI="http://twistedmatrix.com/Releases/${MY_PACKAGE}/$(get_version_component_range 1-2 ${MY_PV})/${MY_P}.tar.bz2"
31
32 LICENSE="MIT"
33 SLOT="0"
34 IUSE=""
35
36 S="${WORKDIR}/${MY_P}"
37
38 TWISTED_PLUGINS="${TWISTED_PLUGINS:-twisted.plugins}"
39 fi
40
41 # @ECLASS-VARIABLE: TWISTED_PLUGINS
42 # @DESCRIPTION:
43 # Twisted plugins, whose cache is regenerated in pkg_postinst() and pkg_postrm() phases.
44
45 twisted_src_test() {
46 if [[ "${CATEGORY}/${PN}" != "dev-python/twisted"* ]]; then
47 die "${FUNCNAME}() can be used only in dev-python/twisted* packages"
48 fi
49
50 testing() {
51 local sitedir="${EPREFIX}$(python_get_sitedir)"
52
53 # Copy modules of other Twisted packages from site-packages directory to temporary directory.
54 mkdir -p "${T}/${sitedir}"
55 cp -R "${ROOT}${sitedir}/twisted" "${T}/${sitedir}" || die "Copying of modules of other Twisted packages failed with $(python_get_implementation) $(python_get_version)"
56 rm -fr "${T}/${sitedir}/${PN/-//}"
57
58 # Install modules of current package to temporary directory.
59 "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --force --no-compile --root="${T}" || die "Installation into temporary directory failed with $(python_get_implementation) $(python_get_version)"
60
61 pushd "${T}/${sitedir}" > /dev/null || return 1
62 PATH="${T}${EPREFIX}/usr/bin:${PATH}" PYTHONPATH="${T}/${sitedir}" trial ${PN/-/.} || return 1
63 popd > /dev/null || return 1
64
65 rm -fr "${T}/${sitedir}"
66 }
67 python_execute_function testing
68 }
69
70 twisted_src_install() {
71 distutils_src_install
72
73 if [[ -d doc/man ]]; then
74 doman doc/man/*.[[:digit:]]
75 fi
76
77 if [[ -d doc ]]; then
78 insinto /usr/share/doc/${PF}
79 doins -r $(find doc -mindepth 1 -maxdepth 1 -not -name man)
80 fi
81 }
82
83 _twisted_update_plugin_cache() {
84 local dir exit_status="0" module
85
86 for module in ${TWISTED_PLUGINS}; do
87 if [[ -d "${EROOT}$(python_get_sitedir -b)/${module//.//}" ]]; then
88 find "${EROOT}$(python_get_sitedir -b)/${module//.//}" -name dropin.cache -print0 | xargs -0 rm -f
89 fi
90 done
91
92 if [[ -n "$(type -p "$(PYTHON)")" ]]; then
93 for module in ${TWISTED_PLUGINS}; do
94 # http://twistedmatrix.com/documents/current/core/howto/plugin.html
95 "$(PYTHON)" -c \
96 "import sys
97 sys.path.insert(0, '${EROOT}$(python_get_sitedir -b)')
98
99 try:
100 import twisted.plugin
101 import ${module}
102 except ImportError:
103 if '${EBUILD_PHASE}' == 'postinst':
104 raise
105 else:
106 # Twisted, zope.interface or given plugins might have been uninstalled.
107 sys.exit(0)
108
109 list(twisted.plugin.getPlugins(twisted.plugin.IPlugin, ${module}))" || exit_status="1"
110 done
111 fi
112
113 for module in ${TWISTED_PLUGINS}; do
114 # Delete empty parent directories.
115 local dir="${EROOT}$(python_get_sitedir -b)/${module//.//}"
116 while [[ "${dir}" != "${EROOT%/}" ]]; do
117 rmdir "${dir}" 2> /dev/null || break
118 dir="${dir%/*}"
119 done
120 done
121
122 return "${exit_status}"
123 }
124
125 twisted_pkg_postinst() {
126 distutils_pkg_postinst
127 python_execute_function \
128 --action-message 'Regeneration of Twisted plugin cache with $(python_get_implementation) $(python_get_version)' \
129 --failure-message 'Regeneration of Twisted plugin cache failed with $(python_get_implementation) $(python_get_version)' \
130 --nonfatal \
131 _twisted_update_plugin_cache
132 }
133
134 twisted_pkg_postrm() {
135 distutils_pkg_postrm
136 python_execute_function \
137 --action-message 'Regeneration of Twisted plugin cache with $(python_get_implementation) $(python_get_version)' \
138 --failure-message 'Regeneration of Twisted plugin cache failed with $(python_get_implementation) $(python_get_version)' \
139 --nonfatal \
140 _twisted_update_plugin_cache
141 }

  ViewVC Help
Powered by ViewVC 1.1.20