summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-09-08 09:06:34 +0200
committerMichał Górny <mgorny@gentoo.org>2018-09-18 08:18:58 +0200
commit7f291f5759959bc338ca0b52b169871f0dccf9a9 (patch)
tree019b058bf4b323cee79fef0aa4295f04ad08fb1a /eclass/python-utils-r1.eclass
parentapp-admin/systemrescuecd-x86: Bump to 5.3.1 (diff)
downloadgentoo-7f291f5759959bc338ca0b52b169871f0dccf9a9.tar.gz
gentoo-7f291f5759959bc338ca0b52b169871f0dccf9a9.tar.bz2
gentoo-7f291f5759959bc338ca0b52b169871f0dccf9a9.zip
python-utils-r1.eclass: Block also pythonX.Y in wrappers
Improve the wrapper blocking logic to block specific Python versions as well rather than just 2/3. In other words, for eselected pythonX.Y both pythonZ (Z = X^1) and python*.* (!= X.Y) will be blocked. Hopefully this will catch more build systems that hardcode Python versions rather than respecting what we're giving them. This will work only for build systems respecting PATH. Build systems (and ebuilds) using /usr/bin path directly will still be able to use other Python versions.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass12
1 files changed, 11 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index e3cf82b4b58..6bcbe2e5a09 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1043,11 +1043,21 @@ python_wrapper_setup() {
nonsupp+=( 2to3 python-config "python${pyver}-config" )
fi
+ # block all other interpreters as incompatible
+ local orig_EPYTHON=${EPYTHON}
local x
+ for x in "${_PYTHON_ALL_IMPLS[@]}"; do
+ python_export "${x}" EPYTHON
+ [[ ${EPYTHON} == ${orig_EPYTHON} ]] && continue
+
+ nonsupp+=( "${EPYTHON}" )
+ [[ ${EPYTHON} == python* ]] && nonsupp+=( "${EPYTHON}-config" )
+ done
+
for x in "${nonsupp[@]}"; do
cat >"${workdir}"/bin/${x} <<-_EOF_ || die
#!/bin/sh
- echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
+ echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${orig_EPYTHON} (PYTHON_COMPAT)" >&2
exit 127
_EOF_
chmod +x "${workdir}"/bin/${x} || die