summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-09-17 15:57:52 +0200
committerMichał Górny <mgorny@gentoo.org>2020-09-17 18:56:21 +0200
commitf58ec7afec183fb7c40fcc28e6db269988c1f762 (patch)
treec2ac27b03eb1cc2b853bc7e8f45abbafd3e591ae /eclass
parentdev-python/pypy3: Fix PYTHON path for byte-compiling modules (diff)
downloadgentoo-f58ec7afec183fb7c40fcc28e6db269988c1f762.tar.gz
gentoo-f58ec7afec183fb7c40fcc28e6db269988c1f762.tar.bz2
gentoo-f58ec7afec183fb7c40fcc28e6db269988c1f762.zip
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@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/python-utils-r1.eclass1
1 files changed, 1 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 87cb662c64fd..9c8b6a14d2ac 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