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

Diff of /eclass/distutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.62 Revision 1.63
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.62 2009/09/09 19:26:00 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.63 2009/09/11 12:24:29 arfrever Exp $
4 4
5# @ECLASS: distutils.eclass 5# @ECLASS: distutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# <python@gentoo.org> 7# <python@gentoo.org>
8# 8#
64 die "${FUNCNAME}() can be used only in src_prepare() phase" 64 die "${FUNCNAME}() can be used only in src_prepare() phase"
65 fi 65 fi
66 66
67 # Delete ez_setup files to prevent packages from installing 67 # Delete ez_setup files to prevent packages from installing
68 # setuptools on their own. 68 # setuptools on their own.
69 local ez_setup_py_existence 69 local ez_setup_existence
70 [[ -f ez_setup.py ]] && ez_setup_py_existence="1" 70 [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence="1"
71 rm -fr ez_setup* 71 rm -fr ez_setup*
72 if [[ "${ez_setup_py_existence}" == "1" ]]; then 72 if [[ "${ez_setup_existence}" == "1" ]]; then
73 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py 73 echo "def use_setuptools(*args, **kwargs): pass" > ez_setup.py
74 fi 74 fi
75 75
76 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then 76 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
77 python_copy_sources 77 python_copy_sources
172 if [[ -n "${DOCS}" ]]; then 172 if [[ -n "${DOCS}" ]]; then
173 dodoc ${DOCS} || die "dodoc failed" 173 dodoc ${DOCS} || die "dodoc failed"
174 fi 174 fi
175} 175}
176 176
177# @FUNCTION: distutils_pkg_postrm 177# @FUNCTION: distutils_pkg_postinst
178# @DESCRIPTION: 178# @DESCRIPTION:
179# Generic pyc/pyo cleanup script. This function is exported. 179# This is a generic optimization, you should override it if your package
180# installs modules in another directory. This function is exported.
180distutils_pkg_postrm() { 181distutils_pkg_postinst() {
181 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then 182 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
182 die "${FUNCNAME}() can be used only in pkg_postrm() phase" 183 die "${FUNCNAME}() can be used only in pkg_postinst() phase"
183 fi 184 fi
184 185
185 local pylibdir pymod 186 local pylibdir pymod
186 if [[ -z "${PYTHON_MODNAME}" ]]; then 187 if [[ -z "${PYTHON_MODNAME}" ]]; then
187 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 188 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
189 PYTHON_MODNAME="${PN}" 190 PYTHON_MODNAME="${PN}"
190 fi 191 fi
191 done 192 done
192 fi 193 fi
193 194
194 if [[ -n "${PYTHON_MODNAME}" ]]; then 195 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
195 for pymod in ${PYTHON_MODNAME}; do 196 for pymod in ${PYTHON_MODNAME}; do
196 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
197 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
198 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
199 python_mod_cleanup "${pymod}" 197 python_mod_optimize "${pymod}"
200 else
201 python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}"
202 fi
203 fi
204 done 198 done
205 done
206 else 199 else
207 python_mod_cleanup 200 for pymod in ${PYTHON_MODNAME}; do
201 python_mod_optimize "$(python_get_sitedir)/${pymod}"
202 done
208 fi 203 fi
209} 204}
210 205
211# @FUNCTION: distutils_pkg_postinst 206# @FUNCTION: distutils_pkg_postrm
212# @DESCRIPTION: 207# @DESCRIPTION:
213# This is a generic optimization, you should override it if your package 208# Generic pyc/pyo cleanup script. This function is exported.
214# installs modules in another directory. This function is exported.
215distutils_pkg_postinst() { 209distutils_pkg_postrm() {
216 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then 210 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
217 die "${FUNCNAME}() can be used only in pkg_postinst() phase" 211 die "${FUNCNAME}() can be used only in pkg_postrm() phase"
218 fi 212 fi
219 213
220 local pylibdir pymod 214 local pylibdir pymod
221 if [[ -z "${PYTHON_MODNAME}" ]]; then 215 if [[ -z "${PYTHON_MODNAME}" ]]; then
222 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 216 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
224 PYTHON_MODNAME="${PN}" 218 PYTHON_MODNAME="${PN}"
225 fi 219 fi
226 done 220 done
227 fi 221 fi
228 222
229 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 223 if [[ -n "${PYTHON_MODNAME}" ]]; then
230 for pymod in ${PYTHON_MODNAME}; do 224 for pymod in ${PYTHON_MODNAME}; do
225 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
231 python_mod_optimize "${pymod}" 226 python_mod_cleanup "${pymod}"
227 else
228 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
229 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
230 python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}"
231 fi
232 done 232 done
233 else 233 fi
234 python_version
235 for pymod in ${PYTHON_MODNAME}; do
236 python_mod_optimize "/usr/$(get_libdir)/python${PYVER}/site-packages/${pymod}"
237 done 234 done
235 else
236 python_mod_cleanup
238 fi 237 fi
239} 238}
240 239
241# @FUNCTION: distutils_python_version 240# @FUNCTION: distutils_python_version
242# @DESCRIPTION: 241# @DESCRIPTION:

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

  ViewVC Help
Powered by ViewVC 1.1.20