commit:     8bea0d57f8e47a532b7d1ccc22296e61573dc66a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 30 11:29:48 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Feb  6 09:57:35 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8bea0d57

dev-lang/python-exec: Reclaim /usr/bin/py* wrappers, #573254

 dev-lang/python-exec/python-exec-2.9999.ebuild | 43 ++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/dev-lang/python-exec/python-exec-2.9999.ebuild 
b/dev-lang/python-exec/python-exec-2.9999.ebuild
index cf4c3eb..8002668 100644
--- a/dev-lang/python-exec/python-exec-2.9999.ebuild
+++ b/dev-lang/python-exec/python-exec-2.9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -27,8 +27,14 @@ SLOT="2"
 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd 
~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
 IUSE=""
 
-RDEPEND="!<dev-python/python-exec-10000
-       !<app-eselect/eselect-python-20151117"
+# eselect-python because of /usr/bin/python* collisions
+# python versions because of missing $scriptdir/python* symlinks
+RDEPEND="
+       !<app-eselect/eselect-python-20160206
+       !<dev-lang/python-2.7.10-r4:2.7
+       !<dev-lang/python-3.3.5-r4:3.3
+       !<dev-lang/python-3.4.3-r4:3.4
+       !<dev-lang/python-3.5.0-r3:3.5"
 
 #if LIVE
 KEYWORDS=
@@ -53,3 +59,34 @@ src_configure() {
 
        econf "${myconf[@]}"
 }
+
+src_install() {
+       default
+
+       local f
+       for f in python{,2,3}; do
+               # can't use symlinks here since random stuff
+               # loves to do readlink on sys.executable...
+               newbin python-exec2-c "${f}"
+       done
+       for f in python{,2,3}-config 2to3 idle pydoc pyvenv; do
+               dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
+       done
+}
+
+pkg_preinst() {
+       local py
+
+       # Copy python[23] selection from the old format (symlink)
+       for py in 2 3; do
+               if [[ -L ${EROOT}/usr/bin/python${py} ]]; then
+                       local target=$(readlink "${EROOT}/usr/bin/python${py}")
+
+                       # check if it's actually old eselect symlink
+                       if [[ ${target} == python?.? ]]; then
+                               einfo "Preserving Python${py} as ${target}"
+                               echo "${target}" > 
"${EROOT}/etc/env.d/python/python${py}" || die
+                       fi
+               fi
+       done
+}

Reply via email to