From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Block also pythonX.Y in wrappers
Date: Sat, 8 Sep 2018 09:09:41 +0200 [thread overview]
Message-ID: <20180908070941.23482-1-mgorny@gentoo.org> (raw)
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.
---
eclass/python-utils-r1.eclass | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index e3cf82b4b58f..6bcbe2e5a09f 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
--
2.19.0.rc2
reply other threads:[~2018-09-08 7:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180908070941.23482-1-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=python@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox