/[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.64
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.64 2009/09/11 20:03:51 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
159 159
160 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 160 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
161 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" 161 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
162 fi 162 fi
163 163
164 if [[ -e "${D}usr/local" ]]; then
165 die "Illegal installation into /usr/local"
166 fi
167
164 local default_docs 168 local default_docs
165 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO" 169 default_docs="AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAINERS MANIFEST* NEWS PKG-INFO README* TODO"
166 170
167 local doc 171 local doc
168 for doc in ${default_docs}; do 172 for doc in ${default_docs}; do
172 if [[ -n "${DOCS}" ]]; then 176 if [[ -n "${DOCS}" ]]; then
173 dodoc ${DOCS} || die "dodoc failed" 177 dodoc ${DOCS} || die "dodoc failed"
174 fi 178 fi
175} 179}
176 180
177# @FUNCTION: distutils_pkg_postrm 181# @FUNCTION: distutils_pkg_postinst
178# @DESCRIPTION: 182# @DESCRIPTION:
179# Generic pyc/pyo cleanup script. This function is exported. 183# This is a generic optimization, you should override it if your package
184# installs modules in another directory. This function is exported.
180distutils_pkg_postrm() { 185distutils_pkg_postinst() {
181 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then 186 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then
182 die "${FUNCNAME}() can be used only in pkg_postrm() phase" 187 die "${FUNCNAME}() can be used only in pkg_postinst() phase"
183 fi 188 fi
184 189
185 local pylibdir pymod 190 local pylibdir pymod
186 if [[ -z "${PYTHON_MODNAME}" ]]; then 191 if [[ -z "${PYTHON_MODNAME}" ]]; then
187 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 192 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
189 PYTHON_MODNAME="${PN}" 194 PYTHON_MODNAME="${PN}"
190 fi 195 fi
191 done 196 done
192 fi 197 fi
193 198
194 if [[ -n "${PYTHON_MODNAME}" ]]; then 199 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
195 for pymod in ${PYTHON_MODNAME}; do 200 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}" 201 python_mod_optimize "${pymod}"
200 else
201 python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}"
202 fi
203 fi
204 done 202 done
205 done
206 else 203 else
207 python_mod_cleanup 204 for pymod in ${PYTHON_MODNAME}; do
205 python_mod_optimize "$(python_get_sitedir)/${pymod}"
206 done
208 fi 207 fi
209} 208}
210 209
211# @FUNCTION: distutils_pkg_postinst 210# @FUNCTION: distutils_pkg_postrm
212# @DESCRIPTION: 211# @DESCRIPTION:
213# This is a generic optimization, you should override it if your package 212# Generic pyc/pyo cleanup script. This function is exported.
214# installs modules in another directory. This function is exported.
215distutils_pkg_postinst() { 213distutils_pkg_postrm() {
216 if [[ "${EBUILD_PHASE}" != "postinst" ]]; then 214 if [[ "${EBUILD_PHASE}" != "postrm" ]]; then
217 die "${FUNCNAME}() can be used only in pkg_postinst() phase" 215 die "${FUNCNAME}() can be used only in pkg_postrm() phase"
218 fi 216 fi
219 217
220 local pylibdir pymod 218 local pylibdir pymod
221 if [[ -z "${PYTHON_MODNAME}" ]]; then 219 if [[ -z "${PYTHON_MODNAME}" ]]; then
222 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do 220 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
224 PYTHON_MODNAME="${PN}" 222 PYTHON_MODNAME="${PN}"
225 fi 223 fi
226 done 224 done
227 fi 225 fi
228 226
229 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 227 if [[ -n "${PYTHON_MODNAME}" ]]; then
230 for pymod in ${PYTHON_MODNAME}; do 228 for pymod in ${PYTHON_MODNAME}; do
229 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
231 python_mod_optimize "${pymod}" 230 python_mod_cleanup "${pymod}"
231 else
232 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
233 if [[ -d "${pylibdir}/site-packages/${pymod}" ]]; then
234 python_mod_cleanup "${pylibdir#${ROOT}}/site-packages/${pymod}"
235 fi
232 done 236 done
233 else 237 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 238 done
239 else
240 python_mod_cleanup
238 fi 241 fi
239} 242}
240 243
241# @FUNCTION: distutils_python_version 244# @FUNCTION: distutils_python_version
242# @DESCRIPTION: 245# @DESCRIPTION:

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

  ViewVC Help
Powered by ViewVC 1.1.20