commit: f58ec7afec183fb7c40fcc28e6db269988c1f762
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 13:57:52 2020 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 16:56:21 2020 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f58ec7af
python-utils-r1.eclass: Make python_optimize fail if -x $PYTHON
Make python_optimize() fail if the expected Python interpreter is not
executable. Since some errors are expected during Python
byte-compilation (e.g. CPython includes test .py modules with syntax
errors), we can't rely on compileall result. However, this will catch
at least the very bad mistake of wrong ${PYTHON} that affects e.g.
dev-python/pypy*.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/python-utils-r1.eclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 87cb662c64f..9c8b6a14d2a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -608,6 +608,7 @@ python_optimize() {
local PYTHON=${PYTHON}
[[ ${PYTHON} ]] || _python_export PYTHON
+ [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
# default to sys.path
if [[ ${#} -eq 0 ]]; then