Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 18 Sep 2018 06:19:15
Message-Id: 1537251538.7f291f5759959bc338ca0b52b169871f0dccf9a9.mgorny@gentoo
1 commit: 7f291f5759959bc338ca0b52b169871f0dccf9a9
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 8 07:06:34 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 18 06:18:58 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7f291f57
7
8 python-utils-r1.eclass: Block also pythonX.Y in wrappers
9
10 Improve the wrapper blocking logic to block specific Python versions
11 as well rather than just 2/3. In other words, for eselected pythonX.Y
12 both pythonZ (Z = X^1) and python*.* (!= X.Y) will be blocked.
13 Hopefully this will catch more build systems that hardcode Python
14 versions rather than respecting what we're giving them.
15
16 This will work only for build systems respecting PATH. Build systems
17 (and ebuilds) using /usr/bin path directly will still be able to use
18 other Python versions.
19
20 eclass/python-utils-r1.eclass | 12 +++++++++++-
21 1 file changed, 11 insertions(+), 1 deletion(-)
22
23 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
24 index e3cf82b4b58..6bcbe2e5a09 100644
25 --- a/eclass/python-utils-r1.eclass
26 +++ b/eclass/python-utils-r1.eclass
27 @@ -1043,11 +1043,21 @@ python_wrapper_setup() {
28 nonsupp+=( 2to3 python-config "python${pyver}-config" )
29 fi
30
31 + # block all other interpreters as incompatible
32 + local orig_EPYTHON=${EPYTHON}
33 local x
34 + for x in "${_PYTHON_ALL_IMPLS[@]}"; do
35 + python_export "${x}" EPYTHON
36 + [[ ${EPYTHON} == ${orig_EPYTHON} ]] && continue
37 +
38 + nonsupp+=( "${EPYTHON}" )
39 + [[ ${EPYTHON} == python* ]] && nonsupp+=( "${EPYTHON}-config" )
40 + done
41 +
42 for x in "${nonsupp[@]}"; do
43 cat >"${workdir}"/bin/${x} <<-_EOF_ || die
44 #!/bin/sh
45 - echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
46 + echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${orig_EPYTHON} (PYTHON_COMPAT)" >&2
47 exit 127
48 _EOF_
49 chmod +x "${workdir}"/bin/${x} || die