python-single-r1.eclass: Allow using PYTHON_USEDEP again

Instead of requiring people to type PYTHON_MULTI_USEDEP, permit shorter
form of PYTHON_USEDEP.  This does not restore the old behavior
but improves consistency between eclasses that was broken
by python-single-r1 API changes.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2020-04-14 07:33:06 +02:00
parent 054c4ddd20
commit 25852a4c58
+14 -8
View File
@@ -22,7 +22,7 @@
# The eclass exports PYTHON_SINGLE_USEDEP that is suitable for depending
# on other packages using the eclass. Dependencies on packages using
# python-r1 should be created via python_gen_cond_dep() function,
# using PYTHON_MULTI_USEDEP placeholder.
# using PYTHON_USEDEP placeholder.
#
# Please note that packages support multiple Python implementations
# (using python-r1 eclass) can not depend on packages not supporting
@@ -146,7 +146,7 @@ EXPORT_FUNCTIONS pkg_setup
# Python implementations.
#
# If you need to depend on a multi-impl (python-r1) package, use
# python_gen_cond_dep with PYTHON_MULTI_USEDEP placeholder instead.
# python_gen_cond_dep with PYTHON_USEDEP placeholder instead.
#
# Example use:
# @CODE
@@ -158,7 +158,7 @@ EXPORT_FUNCTIONS pkg_setup
# python_single_target_python3_4(-)?
# @CODE
# @ECLASS-VARIABLE: PYTHON_MULTI_USEDEP
# @ECLASS-VARIABLE: PYTHON_USEDEP
# @DESCRIPTION:
# This is a placeholder variable supported by python_gen_cond_dep,
# in order to depend on python-r1 packages built for the same Python
@@ -167,7 +167,7 @@ EXPORT_FUNCTIONS pkg_setup
# Example use:
# @CODE
# RDEPEND="$(python_gen_cond_dep '
# dev-python/foo[${PYTHON_MULTI_USEDEP}]
# dev-python/foo[${PYTHON_USEDEP}]
# ')"
# @CODE
#
@@ -176,6 +176,11 @@ EXPORT_FUNCTIONS pkg_setup
# python_targets_python3_4(-)
# @CODE
# @ECLASS-VARIABLE: PYTHON_MULTI_USEDEP
# @DESCRIPTION:
# This is a backwards-compatibility placeholder. Use PYTHON_USEDEP
# instead.
# @ECLASS-VARIABLE: PYTHON_REQUIRED_USE
# @DESCRIPTION:
# This is an eclass-generated required-use expression which ensures
@@ -249,7 +254,7 @@ _python_single_set_globals() {
else
PYTHON_DEPS=${deps}
PYTHON_REQUIRED_USE=${requse}
PYTHON_USEDEP='%PYTHON_USEDEP-HAS-BEEN-REMOVED%'
PYTHON_USEDEP='%PYTHON_USEDEP-NEEDS-TO-BE-USED-IN-PYTHON_GEN_COND_DEP%'
PYTHON_SINGLE_USEDEP=${single_usedep}
readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_SINGLE_USEDEP \
PYTHON_USEDEP
@@ -345,7 +350,7 @@ python_gen_useflags() {
# to prevent accidental shell filename expansion.
#
# In order to enforce USE constraints on the packages, verbatim
# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_MULTI_USEDEP}' (quoted!) may
# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_USEDEP}' (quoted!) may
# be placed in the dependency specification. It will get expanded within
# the function into a proper USE dependency string.
#
@@ -353,7 +358,7 @@ python_gen_useflags() {
# @CODE
# PYTHON_COMPAT=( python{2_7,3_{3,4}} pypy )
# RDEPEND="$(python_gen_cond_dep \
# 'dev-python/unittest2[${PYTHON_MULTI_USEDEP}]' python2_7 pypy )"
# 'dev-python/unittest2[${PYTHON_USEDEP}]' python2_7 pypy )"
# @CODE
#
# It will cause the variable to look like:
@@ -382,8 +387,9 @@ python_gen_cond_dep() {
fi
local multi_usedep="python_targets_${impl}(-)"
local subdep=${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
matches+=( "python_single_target_${impl}? (
${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}} )" )
${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
fi
done