summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-06-01 10:02:28 +0200
committerMichał Górny <mgorny@gentoo.org>2022-06-07 08:53:51 +0200
commit66e4193a006529a15ecb13658eac02e218bad7e0 (patch)
treee44a1771b9148a328a157a4c6d94a88e7e5a1b9b /eclass/python-utils-r1.eclass
parentpython-utils-r1.eclass: Support python_domodule outside src_install (diff)
downloadgentoo-66e4193a006529a15ecb13658eac02e218bad7e0.tar.gz
gentoo-66e4193a006529a15ecb13658eac02e218bad7e0.tar.bz2
gentoo-66e4193a006529a15ecb13658eac02e218bad7e0.zip
python-utils-r1.eclass: Add explicit checks for incorrect phase
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass13
1 files changed, 13 insertions, 0 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index fd04cf374ce4..b9cf9c03caeb 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -696,6 +696,9 @@ python_scriptinto() {
python_doexe() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local f
for f; do
python_newexe "${f}" "${f##*/}"
@@ -714,6 +717,8 @@ python_doexe() {
python_newexe() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
@@ -762,6 +767,9 @@ python_newexe() {
python_doscript() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local _PYTHON_REWRITE_SHEBANG=1
python_doexe "${@}"
}
@@ -786,6 +794,9 @@ python_doscript() {
python_newscript() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local _PYTHON_REWRITE_SHEBANG=1
python_newexe "${@}"
}
@@ -894,6 +905,8 @@ python_domodule() {
python_doheader() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local includedir=$(python_get_includedir)