mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-14 00:16:59 +02:00
eclass/python-r1: Sync with Gentoo
It's from Gentoo commit 52eb3fb4e8b3f38c7f22271ee1150c14bfe97cdd.
This commit is contained in:
parent
cfbf805f6e
commit
179cb46a1d
@ -1,4 +1,4 @@
|
|||||||
# Copyright 1999-2022 Gentoo Authors
|
# Copyright 1999-2023 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: python-r1.eclass
|
# @ECLASS: python-r1.eclass
|
||||||
@ -7,8 +7,8 @@
|
|||||||
# @AUTHOR:
|
# @AUTHOR:
|
||||||
# Author: Michał Górny <mgorny@gentoo.org>
|
# Author: Michał Górny <mgorny@gentoo.org>
|
||||||
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
|
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
|
||||||
# @SUPPORTED_EAPIS: 6 7 8
|
# @SUPPORTED_EAPIS: 7 8
|
||||||
# @PROVIDES: multibuild python-utils-r1
|
# @PROVIDES: python-utils-r1
|
||||||
# @BLURB: A common, simple eclass for Python packages.
|
# @BLURB: A common, simple eclass for Python packages.
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# A common eclass providing helper functions to build and install
|
# A common eclass providing helper functions to build and install
|
||||||
@ -30,29 +30,22 @@
|
|||||||
# For more information, please see the Python Guide:
|
# For more information, please see the Python Guide:
|
||||||
# https://projects.gentoo.org/python/guide/
|
# https://projects.gentoo.org/python/guide/
|
||||||
|
|
||||||
case "${EAPI:-0}" in
|
case ${EAPI} in
|
||||||
[0-5])
|
7|8) ;;
|
||||||
die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
|
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||||
;;
|
|
||||||
[6-8])
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ ! ${_PYTHON_R1} ]]; then
|
if [[ ! ${_PYTHON_R1_ECLASS} ]]; then
|
||||||
|
_PYTHON_R1_ECLASS=1
|
||||||
|
|
||||||
if [[ ${_PYTHON_SINGLE_R1} ]]; then
|
if [[ ${_PYTHON_SINGLE_R1_ECLASS} ]]; then
|
||||||
die 'python-r1.eclass can not be used with python-single-r1.eclass.'
|
die 'python-r1.eclass can not be used with python-single-r1.eclass.'
|
||||||
elif [[ ${_PYTHON_ANY_R1} ]]; then
|
elif [[ ${_PYTHON_ANY_R1_ECLASS} ]]; then
|
||||||
die 'python-r1.eclass can not be used with python-any-r1.eclass.'
|
die 'python-r1.eclass can not be used with python-any-r1.eclass.'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
inherit multibuild python-utils-r1
|
inherit multibuild python-utils-r1
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
# @ECLASS_VARIABLE: PYTHON_COMPAT
|
# @ECLASS_VARIABLE: PYTHON_COMPAT
|
||||||
# @REQUIRED
|
# @REQUIRED
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -243,8 +236,6 @@ _python_set_globals() {
|
|||||||
_python_set_globals
|
_python_set_globals
|
||||||
unset -f _python_set_globals
|
unset -f _python_set_globals
|
||||||
|
|
||||||
if [[ ! ${_PYTHON_R1} ]]; then
|
|
||||||
|
|
||||||
# @FUNCTION: _python_validate_useflags
|
# @FUNCTION: _python_validate_useflags
|
||||||
# @INTERNAL
|
# @INTERNAL
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
@ -625,6 +616,24 @@ _python_multibuild_wrapper() {
|
|||||||
python_foreach_impl() {
|
python_foreach_impl() {
|
||||||
debug-print-function ${FUNCNAME} "${@}"
|
debug-print-function ${FUNCNAME} "${@}"
|
||||||
|
|
||||||
|
if [[ ${_DISTUTILS_R1} ]]; then
|
||||||
|
if has "${EBUILD_PHASE}" prepare configure compile test install &&
|
||||||
|
[[ ! ${_DISTUTILS_CALLING_FOREACH_IMPL} &&
|
||||||
|
! ${_DISTUTILS_FOREACH_IMPL_WARNED} ]]
|
||||||
|
then
|
||||||
|
eqawarn "python_foreach_impl has been called directly while using distutils-r1."
|
||||||
|
eqawarn "Please redefine python_*() phase functions to meet your expectations"
|
||||||
|
eqawarn "instead."
|
||||||
|
_DISTUTILS_FOREACH_IMPL_WARNED=1
|
||||||
|
|
||||||
|
if ! has "${EAPI}" 7 8; then
|
||||||
|
die "Calling python_foreach_impl from distutils-r1 is banned in EAPI ${EAPI}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# undo the eclass-set value to catch nested calls
|
||||||
|
local _DISTUTILS_CALLING_FOREACH_IMPL=
|
||||||
|
fi
|
||||||
|
|
||||||
local MULTIBUILD_VARIANTS
|
local MULTIBUILD_VARIANTS
|
||||||
_python_obtain_impls
|
_python_obtain_impls
|
||||||
|
|
||||||
@ -710,7 +719,7 @@ python_setup() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# (reverse iteration -- newest impl first)
|
# (reverse iteration -- newest impl first)
|
||||||
local found
|
local found i
|
||||||
_python_verify_patterns "${@}"
|
_python_verify_patterns "${@}"
|
||||||
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
|
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
|
||||||
local impl=${_PYTHON_SUPPORTED_IMPLS[i]}
|
local impl=${_PYTHON_SUPPORTED_IMPLS[i]}
|
||||||
@ -786,10 +795,9 @@ python_replicate_script() {
|
|||||||
local f
|
local f
|
||||||
for f; do
|
for f; do
|
||||||
local dosym=dosym
|
local dosym=dosym
|
||||||
[[ ${EAPI} == [67] ]] && dosym=dosym8
|
[[ ${EAPI} == 7 ]] && dosym=dosym8
|
||||||
"${dosym}" -r /usr/lib/python-exec/python-exec2 "${f#${ED}}"
|
"${dosym}" -r /usr/lib/python-exec/python-exec2 "${f#${ED}}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
_PYTHON_R1=1
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user