eclass/python-any-r1: Sync with Gentoo

It's from Gentoo commit 3d67b1ccfacc37308a7236625035dff1156b025c.
This commit is contained in:
Krzesimir Nowak 2023-01-24 10:47:13 +01:00
parent e4ce7d1f30
commit cfbf805f6e

View File

@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
# @SUPPORTED_EAPIS: 6 7 8
# @SUPPORTED_EAPIS: 7 8
# @PROVIDES: python-utils-r1
# @BLURB: An eclass for packages having build-time dependency on Python.
# @DESCRIPTION:
@ -38,26 +38,22 @@
# For more information, please see the Python Guide:
# https://projects.gentoo.org/python/guide/
case "${EAPI:-0}" in
[0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
[6-8]) ;;
*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
case ${EAPI} in
7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ ! ${_PYTHON_ANY_R1} ]]; then
if [[ ! ${_PYTHON_ANY_R1_ECLASS} ]]; then
_PYTHON_ANY_R1_ECLASS=1
if [[ ${_PYTHON_R1} ]]; then
if [[ ${_PYTHON_R1_ECLASS} ]]; then
die 'python-any-r1.eclass can not be used with python-r1.eclass.'
elif [[ ${_PYTHON_SINGLE_R1} ]]; then
elif [[ ${_PYTHON_SINGLE_R1_ECLASS} ]]; then
die 'python-any-r1.eclass can not be used with python-single-r1.eclass.'
fi
inherit python-utils-r1
fi
EXPORT_FUNCTIONS pkg_setup
# @ECLASS_VARIABLE: PYTHON_COMPAT
# @REQUIRED
# @DESCRIPTION:
@ -139,7 +135,7 @@ EXPORT_FUNCTIONS pkg_setup
# Example use:
# @CODE
# python_check_deps() {
# has_version "dev-python/foo[${PYTHON_USEDEP}]"
# python_has_version "dev-python/foo[${PYTHON_USEDEP}]"
# }
# @CODE
#
@ -161,7 +157,7 @@ EXPORT_FUNCTIONS pkg_setup
# Example use:
# @CODE
# python_check_deps() {
# has_version "dev-python/bar[${PYTHON_SINGLE_USEDEP}]"
# python_has_version "dev-python/bar[${PYTHON_SINGLE_USEDEP}]"
# }
# @CODE
#
@ -174,7 +170,6 @@ _python_any_set_globals() {
local usestr deps i PYTHON_PKG_DEP
[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
_PYTHON_ALLOW_PY27=1 \
_python_set_impls
for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
@ -206,8 +201,6 @@ _python_any_set_globals() {
_python_any_set_globals
unset -f _python_any_set_globals
if [[ ! ${_PYTHON_ANY_R1} ]]; then
# @FUNCTION: python_gen_any_dep
# @USAGE: <dependency-block>
# @DESCRIPTION:
@ -228,9 +221,9 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then
# dev-python/baz[${PYTHON_USEDEP}] )')"
#
# python_check_deps() {
# has_version "dev-python/foo[${PYTHON_SINGLE_USEDEP}]" \
# && { has_version "dev-python/bar[${PYTHON_USEDEP}]" \
# || has_version "dev-python/baz[${PYTHON_USEDEP}]"; }
# python_has_version "dev-python/foo[${PYTHON_SINGLE_USEDEP}]" \
# && { python_has_version "dev-python/bar[${PYTHON_USEDEP}]" \
# || python_has_version "dev-python/baz[${PYTHON_USEDEP}]"; }
# }
# @CODE
#
@ -317,6 +310,7 @@ python_setup() {
# fallback to the best installed impl.
# (reverse iteration over _PYTHON_SUPPORTED_IMPLS)
local i
for (( i = ${#_PYTHON_SUPPORTED_IMPLS[@]} - 1; i >= 0; i-- )); do
local impl=${_PYTHON_SUPPORTED_IMPLS[i]}
# avoid checking EPYTHON twice
@ -348,5 +342,6 @@ python-any-r1_pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && python_setup
}
_PYTHON_ANY_R1=1
fi
EXPORT_FUNCTIONS pkg_setup