Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 11/18] python-utils-r1.eclass: Add explicit checks for incorrect phase
Date: Sat, 04 Jun 2022 09:07:18
Message-Id: 20220604090334.4003-12-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 00/18] distutils-r1.eclass D_U_PEP517=no mode & other patches by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/python-utils-r1.eclass | 13 +++++++++++++
4 1 file changed, 13 insertions(+)
5
6 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
7 index fd04cf374ce4..b9cf9c03caeb 100644
8 --- a/eclass/python-utils-r1.eclass
9 +++ b/eclass/python-utils-r1.eclass
10 @@ -696,6 +696,9 @@ python_scriptinto() {
11 python_doexe() {
12 debug-print-function ${FUNCNAME} "${@}"
13
14 + [[ ${EBUILD_PHASE} != install ]] &&
15 + die "${FUNCNAME} can only be used in src_install"
16 +
17 local f
18 for f; do
19 python_newexe "${f}" "${f##*/}"
20 @@ -714,6 +717,8 @@ python_doexe() {
21 python_newexe() {
22 debug-print-function ${FUNCNAME} "${@}"
23
24 + [[ ${EBUILD_PHASE} != install ]] &&
25 + die "${FUNCNAME} can only be used in src_install"
26 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
27 [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
28
29 @@ -762,6 +767,9 @@ python_newexe() {
30 python_doscript() {
31 debug-print-function ${FUNCNAME} "${@}"
32
33 + [[ ${EBUILD_PHASE} != install ]] &&
34 + die "${FUNCNAME} can only be used in src_install"
35 +
36 local _PYTHON_REWRITE_SHEBANG=1
37 python_doexe "${@}"
38 }
39 @@ -786,6 +794,9 @@ python_doscript() {
40 python_newscript() {
41 debug-print-function ${FUNCNAME} "${@}"
42
43 + [[ ${EBUILD_PHASE} != install ]] &&
44 + die "${FUNCNAME} can only be used in src_install"
45 +
46 local _PYTHON_REWRITE_SHEBANG=1
47 python_newexe "${@}"
48 }
49 @@ -894,6 +905,8 @@ python_domodule() {
50 python_doheader() {
51 debug-print-function ${FUNCNAME} "${@}"
52
53 + [[ ${EBUILD_PHASE} != install ]] &&
54 + die "${FUNCNAME} can only be used in src_install"
55 [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
56
57 local includedir=$(python_get_includedir)
58 --
59 2.35.1