| 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.53 2008/10/27 00:19:46 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 | # <python@gentoo.org> |
7 | # <python@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 93 | |
93 | |
| 94 | # @FUNCTION: distutils_pkg_postrm |
94 | # @FUNCTION: distutils_pkg_postrm |
| 95 | # @DESCRIPTION: |
95 | # @DESCRIPTION: |
| 96 | # Generic pyc/pyo cleanup script. This function is exported. |
96 | # Generic pyc/pyo cleanup script. This function is exported. |
| 97 | distutils_pkg_postrm() { |
97 | distutils_pkg_postrm() { |
|
|
98 | local moddir pylibdir pymod |
| 98 | if [ -z "${PYTHON_MODNAME}" ] && \ |
99 | if [[ -z "${PYTHON_MODNAME}" ]]; then |
| 99 | [ -d ${ROOT}/usr/$(get_libdir)/python*/site-packages/${PN} ]; then |
100 | for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do |
|
|
101 | if [[ -d "${pylibdir}"/site-packages/${PN} ]]; then |
| 100 | PYTHON_MODNAME=${PN} |
102 | PYTHON_MODNAME=${PN} |
|
|
103 | fi |
|
|
104 | done |
| 101 | fi |
105 | fi |
| 102 | |
106 | |
| 103 | if has_version ">=dev-lang/python-2.3"; then |
107 | if has_version ">=dev-lang/python-2.3"; then |
| 104 | ebegin "Performing Python Module Cleanup .." |
108 | ebegin "Performing Python Module Cleanup .." |
| 105 | if [ -n "${PYTHON_MODNAME}" ]; then |
109 | if [[ -n "${PYTHON_MODNAME}" ]]; then |
| 106 | for pymod in ${PYTHON_MODNAME}; do |
110 | for pymod in ${PYTHON_MODNAME}; do |
| 107 | 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 |
| 108 | python_mod_cleanup ${moddir} |
112 | if [[ -d "${pylibdir}"/site-packages/${pymod} ]]; then |
|
|
113 | python_mod_cleanup "${pylibdir#${ROOT}}"/site-packages/${pymod} |
|
|
114 | fi |
| 109 | done |
115 | done |
| 110 | done |
116 | done |
| 111 | else |
117 | else |
| 112 | python_mod_cleanup |
118 | python_mod_cleanup |
| 113 | fi |
119 | fi |
| … | |
… | |
| 118 | # @FUNCTION: distutils_pkg_postinst |
124 | # @FUNCTION: distutils_pkg_postinst |
| 119 | # @DESCRIPTION: |
125 | # @DESCRIPTION: |
| 120 | # 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 |
| 121 | # installs things in another directory. This function is exported |
127 | # installs things in another directory. This function is exported |
| 122 | distutils_pkg_postinst() { |
128 | distutils_pkg_postinst() { |
|
|
129 | local pylibdir pymod |
| 123 | if [ -z "${PYTHON_MODNAME}" ] && \ |
130 | if [[ -z "${PYTHON_MODNAME}" ]]; then |
| 124 | [ -d ${ROOT}/usr/$(get_libdir)/python*/site-packages/${PN} ]; then |
131 | for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do |
|
|
132 | if [[ -d "${pylibdir}"/site-packages/${PN} ]]; then |
| 125 | PYTHON_MODNAME=${PN} |
133 | PYTHON_MODNAME=${PN} |
|
|
134 | fi |
|
|
135 | done |
| 126 | fi |
136 | fi |
| 127 | |
137 | |
| 128 | if has_version ">=dev-lang/python-2.3"; then |
138 | if has_version ">=dev-lang/python-2.3"; then |
| 129 | python_version |
139 | python_version |
| 130 | for pymod in ${PYTHON_MODNAME}; do |
140 | for pymod in ${PYTHON_MODNAME}; do |