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 3/6] _distutils-r1_rename_scripts: require explicit path.
Date: Thu, 29 Nov 2012 11:30:36
Message-Id: 1354188694-7229-4-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 ---
2 gx86/eclass/distutils-r1.eclass | 17 +++++++++++------
3 1 file changed, 11 insertions(+), 6 deletions(-)
4
5 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
6 index 0d8df87..e1e89c6 100644
7 --- a/gx86/eclass/distutils-r1.eclass
8 +++ b/gx86/eclass/distutils-r1.eclass
9 @@ -244,15 +244,20 @@ distutils-r1_python_test() {
10 }
11
12 # @FUNCTION: _distutils-r1_rename_scripts
13 +# @USAGE: <path>
14 # @INTERNAL
15 # @DESCRIPTION:
16 # Renames installed Python scripts to be implementation-suffixed.
17 -# ${PYTHON} has to be set to the expected Python executable (which
18 -# hashbang will be grepped for), and ${EPYTHON} to the implementation
19 -# name (for new name).
20 +# ${EPYTHON} needs to be set to the implementation name.
21 +#
22 +# All executable scripts having shebang referencing ${EPYTHON}
23 +# in given path will be renamed.
24 _distutils-r1_rename_scripts() {
25 debug-print-function ${FUNCNAME} "${@}"
26
27 + local path=${1}
28 + [[ ${path} ]] || die "${FUNCNAME}: no path given"
29 +
30 local f
31 # XXX: change this if we ever allow directories in bin/sbin
32 while IFS= read -r -d '' f; do
33 @@ -266,14 +271,14 @@ _distutils-r1_rename_scripts() {
34 debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
35 mv "${f}" "${newf}" || die
36 fi
37 - done < <(find "${D}" -type f -executable -print0)
38 + done < <(find "${path}" -type f -executable -print0)
39 }
40
41 # @FUNCTION: distutils-r1_python_install
42 # @USAGE: [additional-args...]
43 # @DESCRIPTION:
44 # The default python_install(). Runs 'esetup.py install', appending
45 -# the optimization flags. Then calls _distutils-r1_rename_scripts.
46 +# the optimization flags. Then renames the installed scripts.
47 # Any parameters passed to this function will be passed to setup.py.
48 distutils-r1_python_install() {
49 debug-print-function ${FUNCNAME} "${@}"
50 @@ -294,7 +299,7 @@ distutils-r1_python_install() {
51
52 esetup.py install "${flags[@]}" --root="${D}" "${@}"
53
54 - _distutils-r1_rename_scripts
55 + _distutils-r1_rename_scripts "${D}"
56 }
57
58 # @FUNCTION: distutils-r1_python_install_all
59 --
60 1.8.0