summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-17 13:24:39 +0000
committerMichał Górny <mgorny@gentoo.org>2013-09-17 13:24:39 +0000
commit7ba398a91aa74eb10eb5d8f378f0ff93e2ff9046 (patch)
tree2c3a1f2eaaa3fe42f005b016743d2b9a16dd94ea /eclass/distutils-r1.eclass
parentVersion bump (diff)
downloadgentoo-2-7ba398a91aa74eb10eb5d8f378f0ff93e2ff9046.tar.gz
gentoo-2-7ba398a91aa74eb10eb5d8f378f0ff93e2ff9046.tar.bz2
gentoo-2-7ba398a91aa74eb10eb5d8f378f0ff93e2ff9046.zip
Clean up Python script install/wrapping functions.
Diffstat (limited to 'eclass/distutils-r1.eclass')
-rw-r--r--eclass/distutils-r1.eclass35
1 files changed, 17 insertions, 18 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index c2872b30a6dd..1923084d1443 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.77 2013/08/25 21:15:28 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.78 2013/09/17 13:24:39 mgorny Exp $
# @ECLASS: distutils-r1
# @MAINTAINER:
@@ -409,39 +409,37 @@ distutils-r1_python_test() {
:
}
-# @FUNCTION: _distutils-r1_rename_scripts
+# @FUNCTION: _distutils-r1_wrap_scripts
# @USAGE: <path>
# @INTERNAL
# @DESCRIPTION:
-# Renames installed Python scripts to be implementation-suffixed.
-# ${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() {
+# Moves and wraps all installed scripts/executables as necessary.
+_distutils-r1_wrap_scripts() {
debug-print-function ${FUNCNAME} "${@}"
local path=${1}
[[ ${path} ]] || die "${FUNCNAME}: no path given"
+ mkdir -p "${path}/usr/bin" || die
local f
while IFS= read -r -d '' f; do
- debug-print "${FUNCNAME}: found executable at ${f#${D}/}"
+ local basename=${f##*/}
+ debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
local shebang
read -r shebang < "${f}"
- if [[ ${shebang} == '#!'*${EPYTHON}* ]]
- then
+ if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
debug-print "${FUNCNAME}: matching shebang: ${shebang}"
- local newf=${f}-${EPYTHON}
- debug-print "${FUNCNAME}: renaming to ${newf#${D}/}"
+ local newf=${f%/*}/${basename}-${EPYTHON}
+ debug-print "${FUNCNAME}: renaming to ${newf#${path}}"
mv "${f}" "${newf}" || die
- debug-print "${FUNCNAME}: installing wrapper at ${f#${D}/}"
- _python_ln_rel "${path}${EPREFIX}"/usr/bin/python-exec "${f}" || die
+ debug-print "${FUNCNAME}: installing wrapper at /usr/bin/${basename}"
+ _python_ln_rel "${path}${EPREFIX}"/usr/bin/python-exec \
+ "${path}${EPREFIX}/usr/bin/${basename}" || die
fi
- done < <(find "${path}" -type f -executable -print0)
+ done < <(find "${path}/usr/bin" -type f -print0)
}
# @FUNCTION: distutils-r1_python_install
@@ -474,15 +472,16 @@ distutils-r1_python_install() {
local root=${D}/_${EPYTHON}
[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
+ flags+=( --root="${root}" )
- esetup.py install "${flags[@]}" --root="${root}" "${@}"
+ esetup.py install "${flags[@]}" "${@}"
if [[ -d ${root}$(python_get_sitedir)/tests ]]; then
die "Package installs 'tests' package, file collisions likely."
fi
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
- _distutils-r1_rename_scripts "${root}"
+ _distutils-r1_wrap_scripts "${root}"
multibuild_merge_root "${root}" "${D}"
fi
}