summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pipping <sping@gentoo.org>2010-12-01 19:53:20 +0000
committerSebastian Pipping <sping@gentoo.org>2010-12-01 19:53:20 +0000
commita614a92b37e4c6980f02e07e9ba908ecde2c9aa2 (patch)
tree97d56718d5cc69e9b2195a0ae2c47af0b048ab2e /dev-lang/python/python-2.6.5-r3.ebuild
parentQuick version bump to add the beta to ~arch for python-2.7 support, mainly. (... (diff)
downloadgentoo-2-a614a92b37e4c6980f02e07e9ba908ecde2c9aa2.tar.gz
gentoo-2-a614a92b37e4c6980f02e07e9ba908ecde2c9aa2.tar.bz2
gentoo-2-a614a92b37e4c6980f02e07e9ba908ecde2c9aa2.zip
dev-lang/python: Repair, hopefully
(Portage version: 2.1.9.25/cvs/Linux x86_64)
Diffstat (limited to 'dev-lang/python/python-2.6.5-r3.ebuild')
-rw-r--r--dev-lang/python/python-2.6.5-r3.ebuild40
1 files changed, 39 insertions, 1 deletions
diff --git a/dev-lang/python/python-2.6.5-r3.ebuild b/dev-lang/python/python-2.6.5-r3.ebuild
index 7fa00dfe5c79..6f44a5ccd51d 100644
--- a/dev-lang/python/python-2.6.5-r3.ebuild
+++ b/dev-lang/python/python-2.6.5-r3.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.5-r3.ebuild,v 1.9 2010/11/27 12:50:14 sping Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-lang/python/python-2.6.5-r3.ebuild,v 1.10 2010/12/01 19:53:20 sping Exp $
EAPI="2"
@@ -270,13 +270,49 @@ src_install() {
rmdir "${ED}$(python_get_libdir)/lib-old"
}
+save_active_python_version() {
+ active_python_2=$(eselect python show --python2)
+ active_python_3=$(eselect python show --python3)
+ active_python_main=$(eselect python show)
+}
+
+restore_active_python_version() {
+ if [[ -n "${active_python_2}" &&
+ "${active_python_2}" != $(eselect python show --python2) ]] ; then
+ einfo "Restoring active Python 2.x interpreter: ${active_python_2}"
+ eselect python set --python2 "${active_python_2}"
+ fi
+ if [[ -n "${active_python_3}" &&
+ "${active_python_3}" != $(eselect python show --python3) ]] ; then
+ einfo "Restoring active Python 3.x interpreter: ${active_python_3}"
+ eselect python set --python3 "${active_python_3}"
+ fi
+
+ if [[ -n "${active_python_main}" &&
+ "${active_python_main}" != $(eselect python show) ]] ; then
+ einfo "Restoring main active Python interpreter: ${active_python_main}"
+ eselect python set "${active_python_main}"
+ fi
+}
+
+ensure_python_symlink() {
+ if [[ -z "$(eselect python show --python${PV%%.*})" ]]; then
+ eselect python update --python${PV%%.*}
+ fi
+}
+
pkg_preinst() {
+ save_active_python_version
+
if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version "${CATEGORY}/${PN}:2.6" && ! has_version "${CATEGORY}/${PN}:2.7"; then
python_updater_warning="1"
fi
}
pkg_postinst() {
+ restore_active_python_version
+ ensure_python_symlink
+
python_mod_optimize -f -x "/(site-packages|test|tests)/" $(python_get_libdir)
if [[ "${python_updater_warning}" == "1" ]]; then
@@ -293,5 +329,7 @@ pkg_postinst() {
}
pkg_postrm() {
+ ensure_python_symlink
+
python_mod_cleanup $(python_get_libdir)
}