[prev in list] [next in list] [prev in thread] [next in thread]
List: gentoo-dev
Subject: [gentoo-dev] [PATCH 2/2] p-d-ng: use distutils-made scripts instead of 'redoing' them.
From: Michał Górny <mgorny () gentoo ! org>
Date: 2012-09-24 21:49:39
Message-ID: 1348523379-16610-2-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]
Instead of 'redoing' the installed script, just rename the ones
installed by distutils in each phase.
This also changes suffixes from -pythonX_Y to -pythonX.Y for no good
reason.
---
gx86/eclass/python-distutils-ng.eclass | 39 +++++++++++++++++++++++++++-------
1 file changed, 31 insertions(+), 8 deletions(-)
diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index ab13ffc..b478277 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -292,25 +292,48 @@ python-distutils-ng_src_test() {
fi
}
-# Phase function: src_install
-python-distutils-ng_src_install() {
+# A wrapper necessary to 'redo' scripts.
+_python-distutils-ng_install_wrapper() {
if type python_install &> /dev/null; then
- _python-distutils-ng_run_for_each_impl python_install
+ python_install "${@}"
else
- _python-distutils-ng_run_for_each_impl \
- _python-distutils-ng_default_distutils_install
+ _python-distutils-ng_default_distutils_install "${@}"
fi
+ if [[ -z "${PYTHON_DISABLE_SCRIPT_REDOS}" ]]; then
+ local f
+ # XXX: change this if we ever allow directories in bin/sbin
+ for f in "${D}"/{,usr/}{,s}bin/*; do
+ if [[ -x ${f} ]]; then
+ if [[ "$(head -n 1 "${f}")" == '#!'*${PYTHON}* ]]
+ then
+ mv "${f}" "${f}"-${EPYTHON} || die
+ fi
+ fi
+ done
+ fi
+}
+
+# Phase function: src_install
+python-distutils-ng_src_install() {
+ _python-distutils-ng_run_for_each_impl \
+ _python-distutils-ng_install_wrapper
+
if type python_install_all &> /dev/null; then
einfo "Running python_install_all in ${S} for all"
pushd "${S}" &> /dev/null
python_install_all
popd &> /dev/null
fi
-
if [[ -z "${PYTHON_DISABLE_SCRIPT_REDOS}" ]]; then
- for script_file in $(find "${D}"{,usr/}{,s}bin/ -type f -executable 2> /dev/null); do
- python-distutils-ng_redoscript "/${script_file#${D}}"
+ local best_impl=$(_python-distutils-ng_get_best_impl)
+ local f
+
+ # XXX: change this if we ever allow directories in bin/sbin
+ for f in "${D}"/{,usr/}{,s}bin/*-${best_impl/_/.}; do
+ if [[ -x ${f} ]]; then
+ ln -s "${f##*/}" "${f%-*}" || die
+ fi
done
fi
}
--
1.7.12
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic