1 |
commit: 671b6f3393b1b5849b3670334a2881f29169975e |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 1 13:40:31 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 1 14:04:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=671b6f33 |
7 |
|
8 |
dev-lang/python-exec: Remove python2 symlink |
9 |
|
10 |
Stop installing python2* symlinks. We have only one Python 2 |
11 |
interpreter left, so let's move it there. As a bonus, people without |
12 |
Python 2.7 installed will not have it at all. |
13 |
|
14 |
Closes: https://bugs.gentoo.org/745975 |
15 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
16 |
|
17 |
dev-lang/python-exec/python-exec-2.4.6-r2.ebuild | 126 +++++++++++++++++++++++ |
18 |
1 file changed, 126 insertions(+) |
19 |
|
20 |
diff --git a/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild b/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild |
21 |
new file mode 100644 |
22 |
index 00000000000..a5edfb3d622 |
23 |
--- /dev/null |
24 |
+++ b/dev-lang/python-exec/python-exec-2.4.6-r2.ebuild |
25 |
@@ -0,0 +1,126 @@ |
26 |
+# Copyright 1999-2020 Gentoo Authors |
27 |
+# Distributed under the terms of the GNU General Public License v2 |
28 |
+ |
29 |
+EAPI=7 |
30 |
+ |
31 |
+inherit python-utils-r1 |
32 |
+ |
33 |
+DESCRIPTION="Python script wrapper" |
34 |
+HOMEPAGE="https://github.com/mgorny/python-exec/" |
35 |
+SRC_URI="https://github.com/mgorny/python-exec/releases/download/v${PV}/${P}.tar.bz2" |
36 |
+ |
37 |
+LICENSE="BSD-2" |
38 |
+SLOT="2" |
39 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
40 |
+# Internal Python project hack. Do not copy it. Ever. |
41 |
+IUSE="${_PYTHON_ALL_IMPLS[@]/#/python_targets_}" |
42 |
+ |
43 |
+RDEPEND="!<=dev-lang/python-2.7.18-r3:2.7" |
44 |
+ |
45 |
+src_configure() { |
46 |
+ local pyimpls=() i EPYTHON |
47 |
+ for i in "${_PYTHON_ALL_IMPLS[@]}"; do |
48 |
+ if use "python_targets_${i}"; then |
49 |
+ python_export "${i}" EPYTHON |
50 |
+ pyimpls+=( "${EPYTHON}" ) |
51 |
+ fi |
52 |
+ done |
53 |
+ |
54 |
+ local myconf=( |
55 |
+ --with-fallback-path="${EPREFIX}/usr/local/sbin:${EPREFIX}/usr/local/bin:${EPREFIX}/usr/sbin:${EPREFIX}/usr/bin:${EPREFIX}/sbin:${EPREFIX}/bin" |
56 |
+ --with-python-impls="${pyimpls[*]}" |
57 |
+ ) |
58 |
+ |
59 |
+ econf "${myconf[@]}" |
60 |
+} |
61 |
+ |
62 |
+src_install() { |
63 |
+ default |
64 |
+ |
65 |
+ # Prepare and own the template |
66 |
+ insinto /etc/python-exec |
67 |
+ newins - python-exec.conf \ |
68 |
+ < <(sed -n -e '/^#/p' config/python-exec.conf.example) |
69 |
+ |
70 |
+ local programs=( python python3 ) |
71 |
+ local scripts=( python-config python3-config 2to3 idle pydoc pyvenv ) |
72 |
+ |
73 |
+ local f |
74 |
+ for f in "${programs[@]}"; do |
75 |
+ # symlink the C wrapper for python to avoid shebang recursion |
76 |
+ # bug #568974 |
77 |
+ dosym python-exec2c /usr/bin/"${f}" |
78 |
+ done |
79 |
+ for f in "${scripts[@]}"; do |
80 |
+ # those are python scripts (except for new python-configs) |
81 |
+ # so symlink them via the python wrapper |
82 |
+ dosym ../lib/python-exec/python-exec2 /usr/bin/"${f}" |
83 |
+ done |
84 |
+} |
85 |
+ |
86 |
+pkg_preinst() { |
87 |
+ if [[ -e ${EROOT}/etc/python-exec/python-exec.conf ]]; then |
88 |
+ # preserve current configuration |
89 |
+ cp "${EROOT}"/etc/python-exec/python-exec.conf \ |
90 |
+ "${ED}"/etc/python-exec/python-exec.conf || die |
91 |
+ else |
92 |
+ # preserve previous Python version preference |
93 |
+ local py old_pythons=() |
94 |
+ local config_base=${EROOT}/etc/env.d/python |
95 |
+ |
96 |
+ # start with the 'global' preference (2 vs 3) |
97 |
+ if [[ -f ${config_base}/config ]]; then |
98 |
+ old_pythons+=( "$(<${config_base}/config)" ) |
99 |
+ fi |
100 |
+ |
101 |
+ # then try specific py3 selection |
102 |
+ for py in 3; do |
103 |
+ local target= |
104 |
+ |
105 |
+ if [[ -f ${config_base}/python${py} ]]; then |
106 |
+ # try the newer config files |
107 |
+ target=$(<${config_base}/python${py}) |
108 |
+ elif [[ -L ${EROOT}/usr/bin/python${py} ]]; then |
109 |
+ # check the older symlink format |
110 |
+ target=$(readlink "${EROOT}/usr/bin/python${py}") |
111 |
+ |
112 |
+ # check if it's actually old eselect symlink |
113 |
+ [[ ${target} == python?.? ]] || target= |
114 |
+ fi |
115 |
+ |
116 |
+ # add the extra target if found and != global |
117 |
+ if [[ ${target} && ${old_pythons[0]} != ${target} ]]; then |
118 |
+ old_pythons+=( "${target}" ) |
119 |
+ fi |
120 |
+ done |
121 |
+ |
122 |
+ if [[ ${old_pythons[@]} ]]; then |
123 |
+ elog "You seem to have just upgraded into the new version of python-exec" |
124 |
+ elog "that uses python-exec.conf for configuration. The ebuild has attempted" |
125 |
+ elog "to convert your previous configuration to the new format, resulting" |
126 |
+ elog "in the following preferences (most preferred version first):" |
127 |
+ elog |
128 |
+ for py in "${old_pythons[@]}"; do |
129 |
+ elog " ${py}" |
130 |
+ done |
131 |
+ elog |
132 |
+ elog "Those interpreters will be preferred when running Python scripts or" |
133 |
+ elog "calling wrapped Python executables (python, python2, pydoc...)." |
134 |
+ elog "If none of the preferred interpreters are supported, python-exec will" |
135 |
+ elog "fall back to the newest supported Python version." |
136 |
+ elog |
137 |
+ elog "Please note that due to the ambiguous character of the old settings," |
138 |
+ elog "you may want to modify the preference list yourself. In order to do so," |
139 |
+ elog "open the following file in your favorite editor:" |
140 |
+ elog |
141 |
+ elog " ${EROOT}/etc/python-exec/python-exec.conf" |
142 |
+ elog |
143 |
+ elog "For more information on the new configuration format, please read" |
144 |
+ elog "the comment on top of the installed configuration file." |
145 |
+ |
146 |
+ local IFS=$'\n' |
147 |
+ echo "${old_pythons[*]}" \ |
148 |
+ >> "${ED}"/etc/python-exec/python-exec.conf || die |
149 |
+ fi |
150 |
+ fi |
151 |
+} |