summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlastair Tse <liquidx@gentoo.org>2003-10-23 23:15:57 +0000
committerAlastair Tse <liquidx@gentoo.org>2003-10-23 23:15:57 +0000
commitf1140850da73cf8b399d73c2cf19197a37c0607a (patch)
tree61bcd8a5a1c22e798caf6b6b22fce2e4e5da656e /eclass/python.eclass
parentnew version 'n cleanup (diff)
downloadgentoo-2-f1140850da73cf8b399d73c2cf19197a37c0607a.tar.gz
gentoo-2-f1140850da73cf8b399d73c2cf19197a37c0607a.tar.bz2
gentoo-2-f1140850da73cf8b399d73c2cf19197a37c0607a.zip
filter some stderr output, remove empty directories in python_mod_cleanup and make python_mod_exists use virtualx
Diffstat (limited to 'eclass/python.eclass')
-rw-r--r--eclass/python.eclass19
1 files changed, 15 insertions, 4 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass
index 92292d2f5c68..ea445cc5f516 100644
--- a/eclass/python.eclass
+++ b/eclass/python.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/python.eclass,v 1.5 2003/10/17 07:14:26 liquidx Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.6 2003/10/23 23:15:57 liquidx Exp $
#
# Author: Alastair Tse <liquidx@gentoo.org>
#
@@ -17,7 +17,7 @@
# orphaned *.pyc *.pyo
# python_makesym() - Makes /usr/bin/python symlinks
-inherit alternatives
+inherit alternatives virtualx
ECLASS="python"
INHERITED="$INHERITED $ECLASS"
@@ -87,13 +87,19 @@ python_tkinter_exists() {
# python module is installed and loadable. it will return
# TRUE(0) if the module exists, and FALSE(1) if the module does
# not exist.
+#
+# note: we use virtualmake from virtualx.eclass to get around
+# when people build without X available. some packages like
+# pygtk need X avaiable when being imported.
+#
# exam:
# if python_mod_exists gtk; then
# echo "gtk support enabled
# fi
#
python_mod_exists() {
- if ! python -c "import $1" >/dev/null 2>&1; then
+ export maketype="python"
+ if ! virtualmake -c "import $1" >/dev/null 2>&1; then
return 1
fi
return 0
@@ -180,11 +186,16 @@ python_mod_cleanup() {
for path in ${SEARCH_PATH}; do
einfo "Searching ${path} .."
- for obj in $(find ${path} -name *.pyc); do
+ for obj in $(find ${path} -name *.pyc | sort -r); do
src_py="$(echo $obj | sed 's:c$::')"
if [ ! -f "${src_py}" ]; then
einfo "Purging ${src_py}[co]"
rm -f ${src_py}[co]
+ # clean up directory if it is empty
+ current_dir="`dirname ${obj}`"
+ if [ `ls -1 --color=none $current_dir | wc -l 2> /dev/null` -lt 1 ]; then
+ rmdir -f ${current_dir}
+ fi
fi
done
done