Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 09 Feb 2022 09:39:36
Message-Id: 1644396229.39c96ff9f70a0ca447501c0e42efb6fd8c8faa58.mgorny@gentoo
1 commit: 39c96ff9f70a0ca447501c0e42efb6fd8c8faa58
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 4 17:38:59 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 9 08:43:49 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=39c96ff9
7
8 python-single-r1.eclass: Inline & simplify USE-deps in gen_cond_dep
9
10 Generate simpler USE-deps inline in python_gen_cond_dep() and remove
11 _python_gen_usedep(). The original code always repeated USE deps
12 on all targets to aid Portage in giving better suggestions. However,
13 since there always will be exactly one implementation selected, this
14 is unnecessary and we can just have every cond-dep match exactly that
15 one target.
16
17 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
18
19 eclass/python-single-r1.eclass | 45 +++---------------------------------------
20 1 file changed, 3 insertions(+), 42 deletions(-)
21
22 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
23 index 574ee9cfc04e..73afcdc3ed6c 100644
24 --- a/eclass/python-single-r1.eclass
25 +++ b/eclass/python-single-r1.eclass
26 @@ -259,40 +259,6 @@ unset -f _python_single_set_globals
27
28 if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
29
30 -# @FUNCTION: _python_gen_usedep
31 -# @USAGE: [<pattern>...]
32 -# @INTERNAL
33 -# @DESCRIPTION:
34 -# Output a USE dependency string for Python implementations which
35 -# are both in PYTHON_COMPAT and match any of the patterns passed
36 -# as parameters to the function.
37 -#
38 -# The patterns are fnmatch-style patterns (matched via bash
39 -# == operator against PYTHON_COMPAT values). Remember to escape
40 -# or quote the fnmatch patterns to prevent accidental shell filename
41 -# expansion.
42 -#
43 -# This is an internal function used to implement python_gen_cond_dep.
44 -_python_gen_usedep() {
45 - debug-print-function ${FUNCNAME} "${@}"
46 -
47 - local impl matches=()
48 -
49 - _python_verify_patterns "${@}"
50 - for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
51 - if _python_impl_matches "${impl}" "${@}"; then
52 - matches+=(
53 - "python_single_target_${impl}(-)?"
54 - )
55 - fi
56 - done
57 -
58 - [[ ${matches[@]} ]] || die "No supported implementations match python_gen_usedep patterns: ${@}"
59 -
60 - local out=${matches[@]}
61 - echo "${out// /,}"
62 -}
63 -
64 # @FUNCTION: python_gen_useflags
65 # @USAGE: [<pattern>...]
66 # @DESCRIPTION:
67 @@ -372,13 +338,7 @@ python_gen_cond_dep() {
68 _python_verify_patterns "${@}"
69 for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
70 if _python_impl_matches "${impl}" "${@}"; then
71 - # substitute ${PYTHON_SINGLE_USEDEP} if used
72 - # (since python_gen_usedep() will not return
73 - # ${PYTHON_SINGLE_USEDEP}, the code is run at most once)
74 - if [[ ${dep} == *'${PYTHON_SINGLE_USEDEP}'* ]]; then
75 - local usedep=$(_python_gen_usedep "${@}")
76 - dep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${usedep}}
77 - fi
78 + local single_usedep="python_single_target_${impl}(-)"
79 local multi_usedep="python_targets_${impl}(-)"
80
81 if [[ ${EAPI} != [67] ]]; then
82 @@ -387,7 +347,8 @@ python_gen_cond_dep() {
83 fi
84 fi
85
86 - local subdep=${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
87 + local subdep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${single_usedep}}
88 + subdep=${subdep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
89 matches+=( "python_single_target_${impl}? (
90 ${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
91 fi