From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 6466D1381F3 for ; Sun, 15 Sep 2013 09:03:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C2C32E0957; Sun, 15 Sep 2013 09:03:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5DC8AE0957 for ; Sun, 15 Sep 2013 09:03:09 +0000 (UTC) Received: from pomiot.lan (77-255-12-39.adsl.inetia.pl [77.255.12.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 8C6A833EB20; Sun, 15 Sep 2013 09:03:07 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-python@lists.gentoo.org Cc: python@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-python] [PATCH 1/2] distutils-r1: clean up script install/wrapping. Date: Sun, 15 Sep 2013 11:03:25 +0200 Message-Id: <1379235806-15800-2-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1379235806-15800-1-git-send-email-mgorny@gentoo.org> References: <1379098729-2801-1-git-send-email-mgorny@gentoo.org> <1379235806-15800-1-git-send-email-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Discussions centering around the Python ecosystem in Gentoo Linux X-BeenThere: gentoo-python@gentoo.org X-BeenThere: gentoo-python@lists.gentoo.org X-Archives-Salt: 395f97ec-a88b-44c6-90a8-096c509e9902 X-Archives-Hash: da72af1de81200e0275a5580991ba00f --- gx86/eclass/distutils-r1.eclass | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass index c2872b3..985e707 100644 --- a/gx86/eclass/distutils-r1.eclass +++ b/gx86/eclass/distutils-r1.eclass @@ -409,39 +409,38 @@ distutils-r1_python_test() { : } -# @FUNCTION: _distutils-r1_rename_scripts +# @FUNCTION: _distutils-r1_wrap_scripts # @USAGE: # @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 Python scripts installed to PYTHON_SCRIPTDIR +# 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 +473,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 } -- 1.8.3.2