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

Contents of /eclass/twisted.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide 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 mgorny 1.11 # Copyright 1999-2014 Gentoo Foundation
2 marienz 1.1 # Distributed under the terms of the GNU General Public License, v2 or later
3 floppym 1.12 # $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.11 2014/11/20 15:32:09 mgorny Exp $
4 marienz 1.1
5 arfrever 1.8 # @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 mgorny 1.11 #
12 arfrever 1.8 # 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 mgorny 1.11 #
16     # This eclass is DEPRECATED. Please use twisted-r1 instead.
17 arfrever 1.8
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 floppym 1.9 #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 arfrever 1.8
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 marienz 1.1
45     twisted_src_test() {
46 arfrever 1.8 if [[ "${CATEGORY}/${PN}" != "dev-python/twisted"* ]]; then
47     die "${FUNCNAME}() can be used only in dev-python/twisted* packages"
48 marienz 1.3 fi
49 arfrever 1.8
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 marienz 1.1 }
69    
70     twisted_src_install() {
71 arfrever 1.7 distutils_src_install
72 swegener 1.2
73 marienz 1.1 if [[ -d doc/man ]]; then
74 floppym 1.10 doman doc/man/*.[[:digit:]]
75 marienz 1.1 fi
76 swegener 1.2
77 marienz 1.1 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 arfrever 1.8 _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 marienz 1.1
109 arfrever 1.8 list(twisted.plugin.getPlugins(twisted.plugin.IPlugin, ${module}))" || exit_status="1"
110     done
111 arfrever 1.7 fi
112 arfrever 1.8
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 marienz 1.1 }
124    
125     twisted_pkg_postinst() {
126     distutils_pkg_postinst
127 arfrever 1.8 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 marienz 1.1 }
133    
134 arfrever 1.8 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