summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-12-01 10:51:48 +0000
committerMichał Górny <mgorny@gentoo.org>2012-12-01 10:51:48 +0000
commit89e00b90ad616145d8785833837e9c679e443f79 (patch)
tree26f35f205e8568c1839fc33e7d5605efa2bfda9e /eclass
parentForce in-source build in the older version too. (diff)
downloadgentoo-2-89e00b90ad616145d8785833837e9c679e443f79.tar.gz
gentoo-2-89e00b90ad616145d8785833837e9c679e443f79.tar.bz2
gentoo-2-89e00b90ad616145d8785833837e9c679e443f79.zip
Make distutils-r1_rename_scripts private. Rename all matching executables recursively in given path(s) rather than using hardcoded path list.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/distutils-r1.eclass42
2 files changed, 28 insertions, 20 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 96e6f2a7479b..08f14f92cf60 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.533 2012/12/01 09:29:24 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.534 2012/12/01 10:51:48 mgorny Exp $
+
+ 01 Dec 2012; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
+ Make distutils-r1_rename_scripts private. Rename all matching executables
+ recursively in given path(s) rather than using hardcoded path list.
01 Dec 2012; Michał Górny <mgorny@gentoo.org> +python-any-r1.eclass,
python-r1.eclass, python-single-r1.eclass:
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index fc9416b6da7f..128dcc14a196 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.20 2012/11/26 10:05:11 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.21 2012/12/01 10:51:48 mgorny Exp $
# @ECLASS: distutils-r1
# @MAINTAINER:
@@ -243,38 +243,42 @@ distutils-r1_python_test() {
:
}
-# @FUNCTION: distutils-r1_rename_scripts
+# @FUNCTION: _distutils-r1_rename_scripts
+# @USAGE: <path>
+# @INTERNAL
# @DESCRIPTION:
# Renames installed Python scripts to be implementation-suffixed.
-# ${PYTHON} has to be set to the expected Python executable (which
-# hashbang will be grepped for), and ${EPYTHON} to the implementation
-# name (for new name).
-distutils-r1_rename_scripts() {
+# ${EPYTHON} needs to be set to the implementation name.
+#
+# All executable scripts having shebang referencing ${EPYTHON}
+# in given path will be renamed.
+_distutils-r1_rename_scripts() {
debug-print-function ${FUNCNAME} "${@}"
+ local path=${1}
+ [[ ${path} ]] || die "${FUNCNAME}: no path given"
+
local f
# XXX: change this if we ever allow directories in bin/sbin
- for f in "${D}"/{bin,sbin,usr/bin,usr/sbin}/*; do
- if [[ -x ${f} ]]; then
- debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
+ while IFS= read -r -d '' f; do
+ debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
- if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
- then
- debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
+ if [[ "$(head -n 1 "${f}")" == '#!'*${EPYTHON}* ]]
+ then
+ debug-print "${FUNCNAME}: matching shebang: $(head -n 1 "${f}")"
- local newf=${f}-${EPYTHON}
- debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
- mv "${f}" "${newf}" || die
- fi
+ local newf=${f}-${EPYTHON}
+ debug-print "${FUNCNAME}: renamed to ${newf#${D}/}"
+ mv "${f}" "${newf}" || die
fi
- done
+ done < <(find "${path}" -type f -executable -print0)
}
# @FUNCTION: distutils-r1_python_install
# @USAGE: [additional-args...]
# @DESCRIPTION:
# The default python_install(). Runs 'esetup.py install', appending
-# the optimization flags. Then calls distutils-r1_rename_scripts.
+# the optimization flags. Then renames the installed scripts.
# Any parameters passed to this function will be passed to setup.py.
distutils-r1_python_install() {
debug-print-function ${FUNCNAME} "${@}"
@@ -295,7 +299,7 @@ distutils-r1_python_install() {
esetup.py install "${flags[@]}" --root="${D}" "${@}"
- distutils-r1_rename_scripts
+ _distutils-r1_rename_scripts "${D}"
}
# @FUNCTION: distutils-r1_python_install_all