summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-10-30 05:21:46 +0000
committerZac Medico <zmedico@gentoo.org>2008-10-30 05:21:46 +0000
commit01e1d08bb65516df227768170fda902546f42339 (patch)
tree85540b6ff800fa403cc560f1cbb14db1776456b4 /eclass
parentversion bump (diff)
downloadhistorical-01e1d08bb65516df227768170fda902546f42339.tar.gz
historical-01e1d08bb65516df227768170fda902546f42339.tar.bz2
historical-01e1d08bb65516df227768170fda902546f42339.zip
Bug #244946 - Use different syntax to pipe find output into while loops inside
python_mod_cleanup(), as a workaround for a bug in <bash-3.2 which causes incorrect saving of the environment when < <(find ...) syntax is used. The bug causes bash to die when attempting to source the resulting environment file. A similar issue has affected eutils.eclass in the past, triggering bug #215340. Also fix inverted argument validation logic inside python_mod_exists(), broken since version 1.47. Thanks to zlin for reporting.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python.eclass12
1 files changed, 6 insertions, 6 deletions
diff --git a/eclass/python.eclass b/eclass/python.eclass
index 8197700bcab7..36c17b2d567f 100644
--- a/eclass/python.eclass
+++ b/eclass/python.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.53 2008/10/27 12:23:50 hawking Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.54 2008/10/30 05:21:46 zmedico Exp $
# @ECLASS: python.eclass
# @MAINTAINER:
@@ -142,7 +142,7 @@ python_tkinter_exists() {
# echo "gtk support enabled"
# fi
python_mod_exists() {
- [[ "$1" ]] && die "${FUNCNAME} requires an argument!"
+ [[ "$1" ]] || die "${FUNCNAME} requires an argument!"
python -c "import $1" >/dev/null 2>&1
}
@@ -296,16 +296,16 @@ python_mod_cleanup() {
for path in "${SEARCH_PATH[@]}"; do
einfo "Cleaning orphaned Python bytecode from ${path} .."
- while read -rd ''; do
+ find "${path}" -name '*.py[co]' -print0 | while read -rd ''; do
src_py="${REPLY%[co]}"
[[ -f "${src_py}" ]] && continue
einfo "Purging ${src_py}[co]"
rm -f "${src_py}"[co]
- done < <(find "${path}" -name '*.py[co]' -print0)
+ done
# attempt to remove directories that maybe empty
- while read -r dir; do
+ find "${path}" -type d | sort -r | while read -r dir; do
rmdir "${dir}" 2>/dev/null
- done < <(find "${path}" -type d | sort -r)
+ done
done
}