From aa0418ee24f4ef93668f654a62065f3f53b2552d Mon Sep 17 00:00:00 2001 From: Alastair Tse Date: Fri, 17 Oct 2003 07:14:26 +0000 Subject: various bugfixes for byte-compiling --- eclass/distutils.eclass | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'eclass/distutils.eclass') diff --git a/eclass/distutils.eclass b/eclass/distutils.eclass index 1a1170c4fd2e..af7e9e0f7fc5 100644 --- a/eclass/distutils.eclass +++ b/eclass/distutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.18 2003/10/09 15:37:57 liquidx Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.19 2003/10/17 07:14:26 liquidx Exp $ # # Author: Jon Nelson # Current Maintainer: Alastair Tse @@ -55,6 +55,42 @@ distutils_src_install() { [ -n "${mydoc}" ] && dodoc ${mydoc} } +# generic pyc/pyo cleanup script. + +distutils_pkg_postrm() { + PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} + + if has_version ">=dev-lang/python-2.3"; then + ebegin "Performing Python Module Cleanup .." + if [ -n "${PYTHON_MODNAME}" ]; then + for pymod in "${PYTHON_MODNAME}"; do + for moddir in "`ls -d --color=none -1 ${ROOT}usr/lib/python*/site-packages/${pymod}`"; do + python_mod_cleanup ${moddir} + done + done + else + python_mod_cleanup + fi + eend 0 + fi +} + +# this is a generic optimization, you should override it if your package +# installs things in another directory + +distutils_pkg_postinst() { + PYTHON_MODNAME=${PYTHON_MODNAME:-${PN}} + + if has_version ">=dev-lang/python-2.3"; then + python_version + for pymod in "${PYTHON_MODNAME}"; do + if [ -d "${ROOT}usr/lib/python${PYVER}/site-packages/${pymod}" ]; then + python_mod_optimize ${ROOT}usr/lib/python${PYVER}/site-packages/${pymod} + fi + done + fi +} + # e.g. insinto ${ROOT}/usr/include/python${PYVER} distutils_python_version() { @@ -78,5 +114,5 @@ distutils_python_tkinter() { } -EXPORT_FUNCTIONS src_compile src_install +EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm -- cgit v1.2.3-65-gdbad