diff options
author | Michał Górny <mgorny@gentoo.org> | 2012-12-01 10:51:48 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2012-12-01 10:51:48 +0000 |
commit | 6b2946514c45c1d242852a8f531fdd21c163c9b2 (patch) | |
tree | 694c528cb7e421e6d685b2b9511ced432ef6822b /eclass/distutils-r1.eclass | |
parent | Force in-source build in the older version too. (diff) | |
download | historical-6b2946514c45c1d242852a8f531fdd21c163c9b2.tar.gz historical-6b2946514c45c1d242852a8f531fdd21c163c9b2.tar.bz2 historical-6b2946514c45c1d242852a8f531fdd21c163c9b2.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/distutils-r1.eclass')
-rw-r--r-- | eclass/distutils-r1.eclass | 42 |
1 files changed, 23 insertions, 19 deletions
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 |