1 |
arfrever 09/10/30 13:14:18 |
2 |
|
3 |
Modified: twisted.eclass |
4 |
Log: |
5 |
Support installation for multiple versions of Python. |
6 |
|
7 |
Revision Changes Path |
8 |
1.7 eclass/twisted.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/twisted.eclass?rev=1.7&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/twisted.eclass?rev=1.7&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/twisted.eclass?r1=1.6&r2=1.7 |
13 |
|
14 |
Index: twisted.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v |
17 |
retrieving revision 1.6 |
18 |
retrieving revision 1.7 |
19 |
diff -u -r1.6 -r1.7 |
20 |
--- twisted.eclass 29 May 2006 18:46:08 -0000 1.6 |
21 |
+++ twisted.eclass 30 Oct 2009 13:14:17 -0000 1.7 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 2005 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License, v2 or later |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.6 2006/05/29 18:46:08 marienz Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/twisted.eclass,v 1.7 2009/10/30 13:14:17 arfrever Exp $ |
27 |
# |
28 |
# Author: Marien Zwart <marienz@g.o> |
29 |
# |
30 |
@@ -12,64 +12,71 @@ |
31 |
# twisted_src_test relies on the package installing twisted.names to |
32 |
# have a ${PN} of twisted-names. |
33 |
|
34 |
-inherit distutils versionator eutils |
35 |
+inherit distutils eutils versionator |
36 |
|
37 |
-MY_PV=${MY_PV:-${PV}} |
38 |
-MY_VERSION=$(get_version_component_range 1-2 ${MY_PV}) |
39 |
-MY_P=Twisted${MY_PACKAGE}-${MY_PV} |
40 |
+MY_PV="${MY_PV:-${PV}}" |
41 |
+MY_VERSION="$(get_version_component_range 1-2 ${MY_PV})" |
42 |
+MY_P="Twisted${MY_PACKAGE}-${MY_PV}" |
43 |
|
44 |
HOMEPAGE="http://www.twistedmatrix.com/" |
45 |
SRC_URI="http://tmrc.mit.edu/mirror/twisted/${MY_PACKAGE}/${MY_VERSION}/${MY_P}.tar.bz2" |
46 |
|
47 |
LICENSE="MIT" |
48 |
SLOT="0" |
49 |
- |
50 |
IUSE="" |
51 |
|
52 |
S="${WORKDIR}/${MY_P}" |
53 |
|
54 |
twisted_src_test() { |
55 |
- python_version |
56 |
- # This is a hack to make tests work without installing to the live |
57 |
- # filesystem. We copy the twisted site-packages to a temporary |
58 |
- # dir, install there, and run from there. |
59 |
- local spath="usr/$(get_libdir)/python${PYVER}/site-packages/" |
60 |
- mkdir -p "${T}/${spath}" |
61 |
- cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die |
62 |
- |
63 |
- # We have to get rid of the existing version of this package |
64 |
- # instead of just installing on top of it, since if the existing |
65 |
- # package has tests in files the version we are installing does |
66 |
- # not have we end up running fex twisted-names-0.3.0 tests when |
67 |
- # downgrading to twisted-names-0.1.0-r1. |
68 |
- rm -rf "${T}/${spath}/${PN/-//}" |
69 |
- |
70 |
- if has_version ">=dev-lang/python-2.3"; then |
71 |
- "${python}" setup.py install --root="${T}" --no-compile --force \ |
72 |
- --install-lib="${spath}" || die |
73 |
+ if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
74 |
+ testing() { |
75 |
+ # This is a hack to make tests work without installing to the live |
76 |
+ # filesystem. We copy the twisted site-packages to a temporary |
77 |
+ # dir, install there, and run from there. |
78 |
+ local spath="$(python_get_sitedir)" |
79 |
+ mkdir -p "${T}/${spath}" |
80 |
+ cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die "Copying of files failed with Python ${PYTHON_ABI}" |
81 |
+ |
82 |
+ # We have to get rid of the existing version of this package |
83 |
+ # instead of just installing on top of it, since if the existing |
84 |
+ # package has tests in files the version we are installing does |
85 |
+ # not have we end up running e.g. twisted-names-0.3.0 tests when |
86 |
+ # downgrading to twisted-names-0.1.0-r1. |
87 |
+ rm -fr "${T}/${spath}/${PN/-//}" |
88 |
+ |
89 |
+ "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${T}" --no-compile --force || die "Installation for tests failed with Python ${PYTHON_ABI}" |
90 |
+ cd "${T}/${spath}" || die |
91 |
+ PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" trial ${PN/-/.} || die "trial failed with Python ${PYTHON_ABI}" |
92 |
+ cd "${S}" |
93 |
+ rm -fr "${T}/${spath}" |
94 |
+ } |
95 |
+ python_execute_function testing |
96 |
else |
97 |
- "${python}" setup.py install --root="${T}" --force \ |
98 |
- --install-lib="${spath}" || die |
99 |
- fi |
100 |
- cd "${T}/${spath}" || die |
101 |
- local trialopts |
102 |
- if ! has_version ">=dev-python/twisted-2.2"; then |
103 |
- trialopts=-R |
104 |
+ # This is a hack to make tests work without installing to the live |
105 |
+ # filesystem. We copy the twisted site-packages to a temporary |
106 |
+ # dir, install there, and run from there. |
107 |
+ local spath="$(python_get_sitedir)" |
108 |
+ mkdir -p "${T}/${spath}" |
109 |
+ cp -R "${ROOT}${spath}/twisted" "${T}/${spath}" || die |
110 |
+ |
111 |
+ # We have to get rid of the existing version of this package |
112 |
+ # instead of just installing on top of it, since if the existing |
113 |
+ # package has tests in files the version we are installing does |
114 |
+ # not have we end up running fex twisted-names-0.3.0 tests when |
115 |
+ # downgrading to twisted-names-0.1.0-r1. |
116 |
+ rm -rf "${T}/${spath}/${PN/-//}" |
117 |
+ |
118 |
+ "${python}" setup.py install --root="${T}" --no-compile --force || die |
119 |
+ cd "${T}/${spath}" || die |
120 |
+ PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \ |
121 |
+ trial ${PN/-/.} || die "trial failed" |
122 |
+ cd "${S}" |
123 |
+ rm -rf "${T}/${spath}" |
124 |
fi |
125 |
- PATH="${T}/usr/bin:${PATH}" PYTHONPATH="${T}/${spath}" \ |
126 |
- trial ${trialopts} ${PN/-/.} || die "trial failed" |
127 |
- cd "${S}" |
128 |
- rm -rf "${T}/${spath}" |
129 |
} |
130 |
|
131 |
twisted_src_install() { |
132 |
- python_version |
133 |
- # The explicit --install-lib here and in src_test is needed to |
134 |
- # make everything (core and all subpackages) go into lib64 on |
135 |
- # amd64. Without it pure python subpackages install into lib while |
136 |
- # stuff with c extensions goes into lib64. |
137 |
- distutils_src_install \ |
138 |
- --install-lib="usr/$(get_libdir)/python${PYVER}/site-packages/" |
139 |
+ distutils_src_install |
140 |
|
141 |
if [[ -d doc/man ]]; then |
142 |
doman doc/man/* |
143 |
@@ -83,22 +90,29 @@ |
144 |
|
145 |
update_plugin_cache() { |
146 |
einfo "Updating twisted plugin cache..." |
147 |
- python_version |
148 |
# we have to remove the cache or removed plugins won't be removed |
149 |
# from the cache (http://twistedmatrix.com/bugs/issue926) |
150 |
- rm "${ROOT}usr/$(get_libdir)/python${PYVER}/site-packages/twisted/plugins/dropin.cache" |
151 |
+ rm "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" |
152 |
# notice we have to use getPlugIns here for <=twisted-2.0.1 compatibility |
153 |
python -c "from twisted.plugin import IPlugin, getPlugIns;list(getPlugIns(IPlugin))" |
154 |
} |
155 |
|
156 |
twisted_pkg_postrm() { |
157 |
distutils_pkg_postrm |
158 |
- update_plugin_cache |
159 |
+ if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
160 |
+ python_execute_function update_plugin_cache |
161 |
+ else |
162 |
+ update_plugin_cache |
163 |
+ fi |
164 |
} |
165 |
|
166 |
twisted_pkg_postinst() { |
167 |
distutils_pkg_postinst |
168 |
- update_plugin_cache |
169 |
+ if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
170 |
+ python_execute_function update_plugin_cache |
171 |
+ else |
172 |
+ update_plugin_cache |
173 |
+ fi |
174 |
} |
175 |
|
176 |
EXPORT_FUNCTIONS src_test src_install pkg_postrm pkg_postinst |