1 |
zmedico 08/10/30 05:21:46 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Bug #244946 - Use different syntax to pipe find output into while loops inside |
6 |
python_mod_cleanup(), as a workaround for a bug in <bash-3.2 which causes |
7 |
incorrect saving of the environment when < <(find ...) syntax is used. The bug |
8 |
causes bash to die when attempting to source the resulting environment file. |
9 |
A similar issue has affected eutils.eclass in the past, triggering bug #215340. |
10 |
|
11 |
Also fix inverted argument validation logic inside python_mod_exists(), broken |
12 |
since version 1.47. Thanks to zlin for reporting. |
13 |
|
14 |
Revision Changes Path |
15 |
1.54 eclass/python.eclass |
16 |
|
17 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.54&view=markup |
18 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.54&content-type=text/plain |
19 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.53&r2=1.54 |
20 |
|
21 |
Index: python.eclass |
22 |
=================================================================== |
23 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
24 |
retrieving revision 1.53 |
25 |
retrieving revision 1.54 |
26 |
diff -u -r1.53 -r1.54 |
27 |
--- python.eclass 27 Oct 2008 12:23:50 -0000 1.53 |
28 |
+++ python.eclass 30 Oct 2008 05:21:46 -0000 1.54 |
29 |
@@ -1,6 +1,6 @@ |
30 |
# Copyright 1999-2008 Gentoo Foundation |
31 |
# Distributed under the terms of the GNU General Public License v2 |
32 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.53 2008/10/27 12:23:50 hawking Exp $ |
33 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.54 2008/10/30 05:21:46 zmedico Exp $ |
34 |
|
35 |
# @ECLASS: python.eclass |
36 |
# @MAINTAINER: |
37 |
@@ -142,7 +142,7 @@ |
38 |
# echo "gtk support enabled" |
39 |
# fi |
40 |
python_mod_exists() { |
41 |
- [[ "$1" ]] && die "${FUNCNAME} requires an argument!" |
42 |
+ [[ "$1" ]] || die "${FUNCNAME} requires an argument!" |
43 |
python -c "import $1" >/dev/null 2>&1 |
44 |
} |
45 |
|
46 |
@@ -296,16 +296,16 @@ |
47 |
|
48 |
for path in "${SEARCH_PATH[@]}"; do |
49 |
einfo "Cleaning orphaned Python bytecode from ${path} .." |
50 |
- while read -rd ''; do |
51 |
+ find "${path}" -name '*.py[co]' -print0 | while read -rd ''; do |
52 |
src_py="${REPLY%[co]}" |
53 |
[[ -f "${src_py}" ]] && continue |
54 |
einfo "Purging ${src_py}[co]" |
55 |
rm -f "${src_py}"[co] |
56 |
- done < <(find "${path}" -name '*.py[co]' -print0) |
57 |
+ done |
58 |
|
59 |
# attempt to remove directories that maybe empty |
60 |
- while read -r dir; do |
61 |
+ find "${path}" -type d | sort -r | while read -r dir; do |
62 |
rmdir "${dir}" 2>/dev/null |
63 |
- done < <(find "${path}" -type d | sort -r) |
64 |
+ done |
65 |
done |
66 |
} |