eclass/python-r1: Sync with Gentoo

It's from Gentoo commit 227c0ab8ffc9e8a048e329f11359e0d13341f74e.
This commit is contained in:
Flatcar Buildbot 2024-10-21 07:07:09 +00:00
parent c4f1021fa4
commit c786af0b1b

View File

@ -30,14 +30,14 @@
# 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/
if [[ -z ${_PYTHON_R1_ECLASS} ]]; then
_PYTHON_R1_ECLASS=1
case ${EAPI} in case ${EAPI} in
7|8) ;; 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac esac
if [[ -z ${_PYTHON_R1_ECLASS} ]]; then
_PYTHON_R1_ECLASS=1
if [[ ${_PYTHON_SINGLE_R1_ECLASS} ]]; 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_ECLASS} ]]; then elif [[ ${_PYTHON_ANY_R1_ECLASS} ]]; then
@ -129,10 +129,6 @@ inherit multibuild python-utils-r1
# depend on another Python package being built for the same Python # depend on another Python package being built for the same Python
# implementations. # implementations.
# #
# The generate USE-flag list is compatible with packages using python-r1
# and python-distutils-ng eclasses. It must not be used on packages
# using python.eclass.
#
# Example use: # Example use:
# @CODE # @CODE
# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]" # RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
@ -242,7 +238,7 @@ unset -f _python_set_globals
# Enforce the proper setting of PYTHON_TARGETS, if PYTHON_COMPAT_OVERRIDE # Enforce the proper setting of PYTHON_TARGETS, if PYTHON_COMPAT_OVERRIDE
# is not in effect. If it is, just warn that the flags will be ignored. # is not in effect. If it is, just warn that the flags will be ignored.
_python_validate_useflags() { _python_validate_useflags() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
@ -282,7 +278,7 @@ _python_validate_useflags() {
# #
# This is an internal function used to implement python_gen_cond_dep. # This is an internal function used to implement python_gen_cond_dep.
_python_gen_usedep() { _python_gen_usedep() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local impl matches=() local impl matches=()
@ -322,7 +318,7 @@ _python_gen_usedep() {
# REQUIRED_USE="doc? ( || ( python_targets_python2_7 ) )" # REQUIRED_USE="doc? ( || ( python_targets_python2_7 ) )"
# @CODE # @CODE
python_gen_useflags() { python_gen_useflags() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local impl matches=() local impl matches=()
@ -366,7 +362,7 @@ python_gen_useflags() {
# dev-python/unittest2[python_targets_pypy?] )" # dev-python/unittest2[python_targets_pypy?] )"
# @CODE # @CODE
python_gen_cond_dep() { python_gen_cond_dep() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local impl matches=() local impl matches=()
local dep=${1} local dep=${1}
@ -428,7 +424,7 @@ python_gen_cond_dep() {
# dev-python/pypy[xml(+)] ) )" # dev-python/pypy[xml(+)] ) )"
# @CODE # @CODE
python_gen_impl_dep() { python_gen_impl_dep() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local impl matches=() local impl matches=()
local PYTHON_REQ_USE=${1} local PYTHON_REQ_USE=${1}
@ -506,7 +502,7 @@ python_gen_impl_dep() {
# ) # )
# @CODE # @CODE
python_gen_any_dep() { python_gen_any_dep() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local depstr=${1} local depstr=${1}
shift shift
@ -554,7 +550,7 @@ python_gen_any_dep() {
# to implementation-specific build directory matching BUILD_DIR used by # to implementation-specific build directory matching BUILD_DIR used by
# python_foreach_abi(). # python_foreach_abi().
python_copy_sources() { python_copy_sources() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local MULTIBUILD_VARIANTS local MULTIBUILD_VARIANTS
_python_obtain_impls _python_obtain_impls
@ -590,7 +586,7 @@ _python_obtain_impls() {
# Initialize the environment for Python implementation selected # Initialize the environment for Python implementation selected
# for multibuild. # for multibuild.
_python_multibuild_wrapper() { _python_multibuild_wrapper() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
local -x EPYTHON PYTHON local -x EPYTHON PYTHON
local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH} local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH}
@ -616,7 +612,7 @@ _python_multibuild_wrapper() {
# For each command being run, EPYTHON, PYTHON and BUILD_DIR are set # For each command being run, EPYTHON, PYTHON and BUILD_DIR are set
# locally, and the former two are exported to the command environment. # locally, and the former two are exported to the command environment.
python_foreach_impl() { python_foreach_impl() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
_python_sanity_checks _python_sanity_checks
if [[ ${_DISTUTILS_R1_ECLASS} ]]; then if [[ ${_DISTUTILS_R1_ECLASS} ]]; then
@ -708,7 +704,7 @@ python_foreach_impl() {
# } # }
# @CODE # @CODE
python_setup() { python_setup() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
_python_sanity_checks _python_sanity_checks
local has_check_deps local has_check_deps
@ -774,7 +770,7 @@ python_setup() {
# All specified files must start with a 'python' shebang. A file not # All specified files must start with a 'python' shebang. A file not
# having a matching shebang will be refused. # having a matching shebang will be refused.
python_replicate_script() { python_replicate_script() {
debug-print-function ${FUNCNAME} "${@}" debug-print-function ${FUNCNAME} "$@"
_python_replicate_script() { _python_replicate_script() {
local _PYTHON_FIX_SHEBANG_QUIET=1 local _PYTHON_FIX_SHEBANG_QUIET=1
@ -789,7 +785,7 @@ python_replicate_script() {
) )
python_fix_shebang -q \ python_fix_shebang -q \
"${files[@]/*\//${D%/}/${PYTHON_SCRIPTDIR}/}" "${files[@]/*\//${D}${PYTHON_SCRIPTDIR}/}"
} }
local files=( "${@}" ) local files=( "${@}" )