From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KuD3J-0001jF-Ja for garchives@archives.gentoo.org; Sun, 26 Oct 2008 21:21:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1AF31E0259; Sun, 26 Oct 2008 21:21:37 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id E157FE0259 for ; Sun, 26 Oct 2008 21:21:36 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 516B8648F2 for ; Sun, 26 Oct 2008 21:21:35 +0000 (UTC) Received: from hawking by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1KuD3G-0003e0-IO for gentoo-commits@lists.gentoo.org; Sun, 26 Oct 2008 21:21:34 +0000 From: "Ali Polatel (hawking)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, hawking@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: python.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: python.eclass X-VCS-Directories: eclass X-VCS-Committer: hawking X-VCS-Committer-Name: Ali Polatel Content-Type: text/plain; charset=utf8 Message-Id: Sender: Ali Polatel Date: Sun, 26 Oct 2008 21:21:34 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: af872d66-c708-44cf-9a5e-34e7640d89e0 X-Archives-Hash: ddf8aecc9d631c51663cb6cb41f1b7cb hawking 08/10/26 21:21:34 Modified: python.eclass Log: Bashify python_mod_cleanup, make it work for paths with spaces in them. Revision Changes Path 1.50 eclass/python.eclass file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.ecla= ss?rev=3D1.50&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.ecla= ss?rev=3D1.50&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.ecla= ss?r1=3D1.49&r2=3D1.50 Index: python.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- python.eclass 26 Oct 2008 17:46:31 -0000 1.49 +++ python.eclass 26 Oct 2008 21:21:34 -0000 1.50 @@ -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.49 2008/10/2= 6 17:46:31 hawking Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.50 2008/10/2= 6 21:21:34 hawking Exp $ =20 # @ECLASS: python.eclass # @MAINTAINER: @@ -278,7 +278,7 @@ # # This function should only be run in pkg_postrm() python_mod_cleanup() { - local SEARCH_PATH myroot + local SEARCH_PATH=3D() myroot src_py =20 # Check if phase is pkg_postrm() [[ ${EBUILD_PHASE} !=3D postrm ]] &&\ @@ -287,28 +287,25 @@ # strip trailing slash myroot=3D"${ROOT%/}" =20 - if [ $# -gt 0 ]; then - for path in $@; do - SEARCH_PATH=3D"${SEARCH_PATH} ${myroot}/${path#/}" - done + if (($#)); then + SEARCH_PATH=3D("${@#/}") + SEARCH_PATH=3D("${SEARCH_PATH[@]/#/$myroot/}") else - for path in ${myroot}/usr/lib*/python*/site-packages; do - SEARCH_PATH=3D"${SEARCH_PATH} ${path}" - done + SEARCH_PATH=3D("${myroot}"/usr/lib*/python*/site-packages) fi =20 - for path in ${SEARCH_PATH}; do + for path in "${SEARCH_PATH[@]}"; do einfo "Cleaning orphaned Python bytecode from ${path} .." - for obj in $(find ${path} -name '*.py[co]'); do - src_py=3D"${obj%[co]}" - if [ ! -f "${src_py}" ]; then - einfo "Purging ${src_py}[co]" - rm -f ${src_py}[co] - fi - done + while read -rd ''; do + src_py=3D"${REPLY%[co]}" + [[ -f "${src_py}" ]] && continue + einfo "Purging ${src_py}[co]" + rm -f "${src_py}"[co] + done < <(find "${path}" -name '*.py[co]' -print0) + # attempt to remove directories that maybe empty - for dir in $(find ${path} -type d | sort -r); do - rmdir ${dir} 2>/dev/null - done + while read -r dir; do + rmdir "${dir}" 2>/dev/null + done < <(find "${path}" -type d | sort -r) done }