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