summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-02-04 18:38:59 +0100
committerMichał Górny <mgorny@gentoo.org>2022-02-09 09:43:49 +0100
commit39c96ff9f70a0ca447501c0e42efb6fd8c8faa58 (patch)
tree08a835bf1bacaccdce377083bcb75d994dc05f83 /eclass/python-single-r1.eclass
parentpython-utils-r1.eclass: Remove python_wrapper_setup (diff)
downloadgentoo-39c96ff9f70a0ca447501c0e42efb6fd8c8faa58.tar.gz
gentoo-39c96ff9f70a0ca447501c0e42efb6fd8c8faa58.tar.bz2
gentoo-39c96ff9f70a0ca447501c0e42efb6fd8c8faa58.zip
python-single-r1.eclass: Inline & simplify USE-deps in gen_cond_dep
Generate simpler USE-deps inline in python_gen_cond_dep() and remove _python_gen_usedep(). The original code always repeated USE deps on all targets to aid Portage in giving better suggestions. However, since there always will be exactly one implementation selected, this is unnecessary and we can just have every cond-dep match exactly that one target. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/python-single-r1.eclass')
-rw-r--r--eclass/python-single-r1.eclass45
1 files changed, 3 insertions, 42 deletions
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 574ee9cfc04e..73afcdc3ed6c 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -259,40 +259,6 @@ unset -f _python_single_set_globals
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
-# @FUNCTION: _python_gen_usedep
-# @USAGE: [<pattern>...]
-# @INTERNAL
-# @DESCRIPTION:
-# Output a USE dependency string for Python implementations which
-# are both in PYTHON_COMPAT and match any of the patterns passed
-# as parameters to the function.
-#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
-#
-# This is an internal function used to implement python_gen_cond_dep.
-_python_gen_usedep() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl matches=()
-
- _python_verify_patterns "${@}"
- for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
- if _python_impl_matches "${impl}" "${@}"; then
- matches+=(
- "python_single_target_${impl}(-)?"
- )
- fi
- done
-
- [[ ${matches[@]} ]] || die "No supported implementations match python_gen_usedep patterns: ${@}"
-
- local out=${matches[@]}
- echo "${out// /,}"
-}
-
# @FUNCTION: python_gen_useflags
# @USAGE: [<pattern>...]
# @DESCRIPTION:
@@ -372,13 +338,7 @@ python_gen_cond_dep() {
_python_verify_patterns "${@}"
for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
if _python_impl_matches "${impl}" "${@}"; then
- # substitute ${PYTHON_SINGLE_USEDEP} if used
- # (since python_gen_usedep() will not return
- # ${PYTHON_SINGLE_USEDEP}, the code is run at most once)
- if [[ ${dep} == *'${PYTHON_SINGLE_USEDEP}'* ]]; then
- local usedep=$(_python_gen_usedep "${@}")
- dep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${usedep}}
- fi
+ local single_usedep="python_single_target_${impl}(-)"
local multi_usedep="python_targets_${impl}(-)"
if [[ ${EAPI} != [67] ]]; then
@@ -387,7 +347,8 @@ python_gen_cond_dep() {
fi
fi
- local subdep=${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
+ local subdep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${single_usedep}}
+ subdep=${subdep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
matches+=( "python_single_target_${impl}? (
${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
fi