Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH distutils-r1 2/6] Rename all Python executables in distutils-r1_rename_scripts.
Date: Thu, 29 Nov 2012 11:30:25
Message-Id: 1354188694-7229-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-python] distutils-r1: a bit of clean up + parallel builds by "Michał Górny"
1 Do not use hardcoded paths.
2 ---
3 gx86/eclass/distutils-r1.eclass | 20 +++++++++-----------
4 1 file changed, 9 insertions(+), 11 deletions(-)
5
6 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
7 index ee7dc83..0d8df87 100644
8 --- a/gx86/eclass/distutils-r1.eclass
9 +++ b/gx86/eclass/distutils-r1.eclass
10 @@ -255,20 +255,18 @@ _distutils-r1_rename_scripts() {
11
12 local f
13 # XXX: change this if we ever allow directories in bin/sbin
14 - for f in "${D}"/{bin,sbin,usr/bin,usr/sbin}/*; do
15 - if [[ -x ${f} ]]; then
16 - debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
17 + while IFS= read -r -d '' f; do
18 + debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
19
20 - if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
21 - then
22 - debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
23 + if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
24 + then
25 + debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
26
27 - local newf=${f}-${EPYTHON}
28 - debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
29 - mv "${f}" "${newf}" || die
30 - fi
31 + local newf=${f}-${EPYTHON}
32 + debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
33 + mv "${f}" "${newf}" || die
34 fi
35 - done
36 + done < <(find "${D}" -type f -executable -print0)
37 }
38
39 # @FUNCTION: distutils-r1_python_install
40 --
41 1.8.0