dev-lang/python-exec: Install python{2,3} conditionally
authorMichał Górny <mgorny@gentoo.org>
Mon, 9 Sep 2019 16:19:26 +0000 (18:19 +0200)
committerMichał Górny <mgorny@gentoo.org>
Mon, 9 Sep 2019 18:48:08 +0000 (20:48 +0200)
Closes: https://bugs.gentoo.org/693910
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/12892
Signed-off-by: Michał Górny <mgorny@gentoo.org>
dev-lang/python-exec/python-exec-2.4.6-r1.ebuild
dev-lang/python-exec/python-exec-9999.ebuild

index 9f56ea1a1d853b4d3eac7144d226bca9ae87008f..d18086c2f1383685d6ab51c4eadfd61c4ac4ccea 100644 (file)
@@ -49,13 +49,29 @@ src_install() {
        newins - python-exec.conf \
                < <(sed -n -e '/^#/p' config/python-exec.conf.example)
 
+       local programs=( python )
+       local scripts=( python-config 2to3 idle pydoc pyvenv )
+       local i
+       for i in "${_PYTHON_ALL_IMPLS[@]}"; do
+               if use "python_targets_${i}"; then
+                       # NB: duplicate entries are harmless
+                       if python_is_python3 "${i}"; then
+                               programs+=( python3 )
+                               scripts+=( python3-config )
+                       else
+                               programs+=( python2 )
+                               scripts+=( python2-config )
+                       fi
+               fi
+       done
+
        local f
-       for f in python{,2,3}; do
+       for f in "${programs[@]}"; do
                # symlink the C wrapper for python to avoid shebang recursion
                # bug #568974
                dosym python-exec2c /usr/bin/"${f}"
        done
-       for f in python{,2,3}-config 2to3 idle pydoc pyvenv; do
+       for f in "${scripts[@]}"; do
                # those are python scripts (except for new python-configs)
                # so symlink them via the python wrapper
                dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"
index ca430aeaf2d8ace6768b7f3bac3e339312cd6eeb..b37d3e0c3b6ff797c861bad0ff16a2ba62952e3a 100644 (file)
@@ -55,13 +55,29 @@ src_install() {
        newins - python-exec.conf \
                < <(sed -n -e '/^#/p' config/python-exec.conf.example)
 
+       local programs=( python )
+       local scripts=( python-config 2to3 idle pydoc pyvenv )
+       local i
+       for i in "${_PYTHON_ALL_IMPLS[@]}"; do
+               if use "python_targets_${i}"; then
+                       # NB: duplicate entries are harmless
+                       if python_is_python3 "${i}"; then
+                               programs+=( python3 )
+                               scripts+=( python3-config )
+                       else
+                               programs+=( python2 )
+                               scripts+=( python2-config )
+                       fi
+               fi
+       done
+
        local f
-       for f in python{,2,3}; do
+       for f in "${programs[@]}"; do
                # symlink the C wrapper for python to avoid shebang recursion
                # bug #568974
                dosym python-exec2c /usr/bin/"${f}"
        done
-       for f in python{,2,3}-config 2to3 idle pydoc pyvenv; do
+       for f in "${scripts[@]}"; do
                # those are python scripts (except for new python-configs)
                # so symlink them via the python wrapper
                dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}"