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

Diff of /eclass/distutils.eclass

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

Revision 1.47 Revision 1.54
1# Copyright 1999-2008 Gentoo Foundation 1# Copyright 1999-2008 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.47 2008/05/29 15:24:51 hawking Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.54 2008/10/28 21:29:28 hawking Exp $
4 4
5# @ECLASS: distutils.eclass 5# @ECLASS: distutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Alastair Tse <liquidx@gentoo.org> 7# <python@gentoo.org>
8# 8#
9# Original author: Jon Nelson <jnelson@gentoo.org> 9# Original author: Jon Nelson <jnelson@gentoo.org>
10# @BLURB: This eclass allows easier installation of distutils-based python modules 10# @BLURB: This eclass allows easier installation of distutils-based python modules
11# @DESCRIPTION: 11# @DESCRIPTION:
12# The distutils eclass is designed to allow easier installation of 12# The distutils eclass is designed to allow easier installation of
61# The distutils src_install function, this function is exported. 61# The distutils src_install function, this function is exported.
62# It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, MAINTAINERS, 62# It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, MAINTAINERS,
63# PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS) 63# PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS)
64distutils_src_install() { 64distutils_src_install() {
65 65
66 # Mark the package to be rebuilt after a python upgrade.
67 python_need_rebuild
68
66 # need this for python-2.5 + setuptools in cases where 69 # need this for python-2.5 + setuptools in cases where
67 # a package uses distutils but does not install anything 70 # a package uses distutils but does not install anything
68 # in site-packages. (eg. dev-java/java-config-2.x) 71 # in site-packages. (eg. dev-java/java-config-2.x)
69 # - liquidx (14/08/2006) 72 # - liquidx (14/08/2006)
70 pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()')" 73 pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()')"
71 [ -n "${pylibdir}" ] && dodir "${pylibdir}" 74 [ -n "${pylibdir}" ] && dodir "${pylibdir}"
72 75
73 if has_version ">=dev-lang/python-2.3"; then 76 if has_version ">=dev-lang/python-2.3"; then
74 ${python} setup.py install --root=${D} --no-compile "$@" || die 77 ${python} setup.py install --root="${D}" --no-compile "$@" ||\
78 die "python setup.py install failed"
75 else 79 else
76 ${python} setup.py install --root=${D} "$@" || die 80 ${python} setup.py install --root="${D}" "$@" ||\
81 die "python setup.py install failed"
77 fi 82 fi
78 83
79 DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS" 84 DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS"
80 DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS" 85 DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS"
81 86
88 93
89# @FUNCTION: distutils_pkg_postrm 94# @FUNCTION: distutils_pkg_postrm
90# @DESCRIPTION: 95# @DESCRIPTION:
91# Generic pyc/pyo cleanup script. This function is exported. 96# Generic pyc/pyo cleanup script. This function is exported.
92distutils_pkg_postrm() { 97distutils_pkg_postrm() {
93 PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} 98 local moddir pylibdir pymod
99 if [[ -z "${PYTHON_MODNAME}" ]]; then
100 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
101 if [[ -d "${pylibdir}"/site-packages/${PN} ]]; then
102 PYTHON_MODNAME=${PN}
103 fi
104 done
105 fi
94 106
95 if has_version ">=dev-lang/python-2.3"; then 107 if has_version ">=dev-lang/python-2.3"; then
96 ebegin "Performing Python Module Cleanup .." 108 ebegin "Performing Python Module Cleanup .."
97 if [ -n "${PYTHON_MODNAME}" ]; then 109 if [[ -n "${PYTHON_MODNAME}" ]]; then
98 for pymod in ${PYTHON_MODNAME}; do 110 for pymod in ${PYTHON_MODNAME}; do
99 for moddir in "`ls -d --color=none -1 ${ROOT}usr/$(get_libdir)/python*/site-packages/${pymod} 2> /dev/null`"; do 111 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
100 python_mod_cleanup ${moddir} 112 if [[ -d "${pylibdir}"/site-packages/${pymod} ]]; then
113 python_mod_cleanup "${pylibdir#${ROOT}}"/site-packages/${pymod}
114 fi
101 done 115 done
102 done 116 done
103 else 117 else
104 python_mod_cleanup 118 python_mod_cleanup
105 fi 119 fi
110# @FUNCTION: distutils_pkg_postinst 124# @FUNCTION: distutils_pkg_postinst
111# @DESCRIPTION: 125# @DESCRIPTION:
112# This is a generic optimization, you should override it if your package 126# This is a generic optimization, you should override it if your package
113# installs things in another directory. This function is exported 127# installs things in another directory. This function is exported
114distutils_pkg_postinst() { 128distutils_pkg_postinst() {
115 PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} 129 local pylibdir pymod
130 if [[ -z "${PYTHON_MODNAME}" ]]; then
131 for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do
132 if [[ -d "${pylibdir}"/site-packages/${PN} ]]; then
133 PYTHON_MODNAME=${PN}
134 fi
135 done
136 fi
116 137
117 if has_version ">=dev-lang/python-2.3"; then 138 if has_version ">=dev-lang/python-2.3"; then
118 python_version 139 python_version
119 for pymod in ${PYTHON_MODNAME}; do 140 for pymod in ${PYTHON_MODNAME}; do
120 python_mod_optimize \ 141 python_mod_optimize \

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20