Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: distutils-r1.eclass ChangeLog
Date: Sat, 01 Dec 2012 10:52:00
Message-Id: 20121201105148.A04F12167F@flycatcher.gentoo.org
1 mgorny 12/12/01 10:51:48
2
3 Modified: distutils-r1.eclass ChangeLog
4 Log:
5 Make distutils-r1_rename_scripts private. Rename all matching executables recursively in given path(s) rather than using hardcoded path list.
6
7 Revision Changes Path
8 1.21 eclass/distutils-r1.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.21&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.21&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.20&r2=1.21
13
14 Index: distutils-r1.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
17 retrieving revision 1.20
18 retrieving revision 1.21
19 diff -u -r1.20 -r1.21
20 --- distutils-r1.eclass 26 Nov 2012 10:05:11 -0000 1.20
21 +++ distutils-r1.eclass 1 Dec 2012 10:51:48 -0000 1.21
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2012 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.20 2012/11/26 10:05:11 mgorny Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.21 2012/12/01 10:51:48 mgorny Exp $
27
28 # @ECLASS: distutils-r1
29 # @MAINTAINER:
30 @@ -243,38 +243,42 @@
31 :
32 }
33
34 -# @FUNCTION: distutils-r1_rename_scripts
35 +# @FUNCTION: _distutils-r1_rename_scripts
36 +# @USAGE: <path>
37 +# @INTERNAL
38 # @DESCRIPTION:
39 # Renames installed Python scripts to be implementation-suffixed.
40 -# ${PYTHON} has to be set to the expected Python executable (which
41 -# hashbang will be grepped for), and ${EPYTHON} to the implementation
42 -# name (for new name).
43 -distutils-r1_rename_scripts() {
44 +# ${EPYTHON} needs to be set to the implementation name.
45 +#
46 +# All executable scripts having shebang referencing ${EPYTHON}
47 +# in given path will be renamed.
48 +_distutils-r1_rename_scripts() {
49 debug-print-function ${FUNCNAME} "${@}"
50
51 + local path=${1}
52 + [[ ${path} ]] || die "${FUNCNAME}: no path given"
53 +
54 local f
55 # XXX: change this if we ever allow directories in bin/sbin
56 - for f in "${D}"/{bin,sbin,usr/bin,usr/sbin}/*; do
57 - if [[ -x ${f} ]]; then
58 - debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
59 -
60 - if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
61 - then
62 - debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
63 -
64 - local newf=${f}-${EPYTHON}
65 - debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
66 - mv "${f}" "${newf}" || die
67 - fi
68 + while IFS= read -r -d '' f; do
69 + debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
70 +
71 + if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
72 + then
73 + debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
74 +
75 + local newf=${f}-${EPYTHON}
76 + debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
77 + mv "${f}" "${newf}" || die
78 fi
79 - done
80 + done < <(find "${path}" -type f -executable -print0)
81 }
82
83 # @FUNCTION: distutils-r1_python_install
84 # @USAGE: [additional-args...]
85 # @DESCRIPTION:
86 # The default python_install(). Runs 'esetup.py install', appending
87 -# the optimization flags. Then calls distutils-r1_rename_scripts.
88 +# the optimization flags. Then renames the installed scripts.
89 # Any parameters passed to this function will be passed to setup.py.
90 distutils-r1_python_install() {
91 debug-print-function ${FUNCNAME} "${@}"
92 @@ -295,7 +299,7 @@
93
94 esetup.py install "${flags[@]}" --root="${D}" "${@}"
95
96 - distutils-r1_rename_scripts
97 + _distutils-r1_rename_scripts "${D}"
98 }
99
100 # @FUNCTION: distutils-r1_python_install_all
101
102
103
104 1.534 eclass/ChangeLog
105
106 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.534&view=markup
107 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.534&content-type=text/plain
108 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.533&r2=1.534
109
110 Index: ChangeLog
111 ===================================================================
112 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
113 retrieving revision 1.533
114 retrieving revision 1.534
115 diff -u -r1.533 -r1.534
116 --- ChangeLog 1 Dec 2012 09:29:24 -0000 1.533
117 +++ ChangeLog 1 Dec 2012 10:51:48 -0000 1.534
118 @@ -1,6 +1,10 @@
119 # ChangeLog for eclass directory
120 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
121 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.533 2012/12/01 09:29:24 mgorny Exp $
122 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.534 2012/12/01 10:51:48 mgorny Exp $
123 +
124 + 01 Dec 2012; Michał Górny <mgorny@g.o> distutils-r1.eclass:
125 + Make distutils-r1_rename_scripts private. Rename all matching executables
126 + recursively in given path(s) rather than using hardcoded path list.
127
128 01 Dec 2012; Michał Górny <mgorny@g.o> +python-any-r1.eclass,
129 python-r1.eclass, python-single-r1.eclass: