Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   p-d-ng: use distutils-made scripts instead of 'redoing' them. (http://www.linux-archive.org/gentoo-development/707063-p-d-ng-use-distutils-made-scripts-instead-redoing-them.html)

Michał Górny 09-24-2012 09:49 PM

p-d-ng: use distutils-made scripts instead of 'redoing' them.
 
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


All times are GMT. The time now is 09:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.