Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-single-r1.eclass: Allow using PYTHON_USEDEP again
Date: Sun, 22 Mar 2020 05:53:43
Message-Id: 20200322055307.4372-1-mgorny@gentoo.org
1 Instead of requiring people to type PYTHON_MULTI_USEDEP, permit shorter
2 form of PYTHON_USEDEP. This does not restore the old behavior
3 but improves consistency between eclasses that was broken
4 by python-single-r1 API changes.
5
6 Signed-off-by: Michał Górny <mgorny@g.o>
7 ---
8 eclass/python-single-r1.eclass | 22 ++++++++++++++--------
9 1 file changed, 14 insertions(+), 8 deletions(-)
10
11 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
12 index ab3df94dcf11..d516e3629696 100644
13 --- a/eclass/python-single-r1.eclass
14 +++ b/eclass/python-single-r1.eclass
15 @@ -22,7 +22,7 @@
16 # The eclass exports PYTHON_SINGLE_USEDEP that is suitable for depending
17 # on other packages using the eclass. Dependencies on packages using
18 # python-r1 should be created via python_gen_cond_dep() function,
19 -# using PYTHON_MULTI_USEDEP placeholder.
20 +# using PYTHON_USEDEP placeholder.
21 #
22 # Please note that packages support multiple Python implementations
23 # (using python-r1 eclass) can not depend on packages not supporting
24 @@ -146,7 +146,7 @@ EXPORT_FUNCTIONS pkg_setup
25 # Python implementations.
26 #
27 # If you need to depend on a multi-impl (python-r1) package, use
28 -# python_gen_cond_dep with PYTHON_MULTI_USEDEP placeholder instead.
29 +# python_gen_cond_dep with PYTHON_USEDEP placeholder instead.
30 #
31 # Example use:
32 # @CODE
33 @@ -158,7 +158,7 @@ EXPORT_FUNCTIONS pkg_setup
34 # python_single_target_python3_4(-)?
35 # @CODE
36
37 -# @ECLASS-VARIABLE: PYTHON_MULTI_USEDEP
38 +# @ECLASS-VARIABLE: PYTHON_USEDEP
39 # @DESCRIPTION:
40 # This is a placeholder variable supported by python_gen_cond_dep,
41 # in order to depend on python-r1 packages built for the same Python
42 @@ -167,7 +167,7 @@ EXPORT_FUNCTIONS pkg_setup
43 # Example use:
44 # @CODE
45 # RDEPEND="$(python_gen_cond_dep '
46 -# dev-python/foo[${PYTHON_MULTI_USEDEP}]
47 +# dev-python/foo[${PYTHON_USEDEP}]
48 # ')"
49 # @CODE
50 #
51 @@ -176,6 +176,11 @@ EXPORT_FUNCTIONS pkg_setup
52 # python_targets_python3_4(-)
53 # @CODE
54
55 +# @ECLASS-VARIABLE: PYTHON_MULTI_USEDEP
56 +# @DESCRIPTION:
57 +# This is a backwards-compatibility placeholder. Use PYTHON_USEDEP
58 +# instead.
59 +
60 # @ECLASS-VARIABLE: PYTHON_REQUIRED_USE
61 # @DESCRIPTION:
62 # This is an eclass-generated required-use expression which ensures
63 @@ -249,7 +254,7 @@ _python_single_set_globals() {
64 else
65 PYTHON_DEPS=${deps}
66 PYTHON_REQUIRED_USE=${requse}
67 - PYTHON_USEDEP='%PYTHON_USEDEP-HAS-BEEN-REMOVED%'
68 + PYTHON_USEDEP='%PYTHON_USEDEP-NEEDS-TO-BE-USED-IN-PYTHON_GEN_COND_DEP%'
69 PYTHON_SINGLE_USEDEP=${single_usedep}
70 readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_SINGLE_USEDEP \
71 PYTHON_USEDEP
72 @@ -345,7 +350,7 @@ python_gen_useflags() {
73 # to prevent accidental shell filename expansion.
74 #
75 # In order to enforce USE constraints on the packages, verbatim
76 -# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_MULTI_USEDEP}' (quoted!) may
77 +# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_USEDEP}' (quoted!) may
78 # be placed in the dependency specification. It will get expanded within
79 # the function into a proper USE dependency string.
80 #
81 @@ -353,7 +358,7 @@ python_gen_useflags() {
82 # @CODE
83 # PYTHON_COMPAT=( python{2_7,3_{3,4}} pypy )
84 # RDEPEND="$(python_gen_cond_dep \
85 -# 'dev-python/unittest2[${PYTHON_MULTI_USEDEP}]' python2_7 pypy )"
86 +# 'dev-python/unittest2[${PYTHON_USEDEP}]' python2_7 pypy )"
87 # @CODE
88 #
89 # It will cause the variable to look like:
90 @@ -382,8 +387,9 @@ python_gen_cond_dep() {
91 fi
92 local multi_usedep="python_targets_${impl}(-)"
93
94 + local subdep=${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}}
95 matches+=( "python_single_target_${impl}? (
96 - ${dep//\$\{PYTHON_MULTI_USEDEP\}/${multi_usedep}} )" )
97 + ${subdep//\$\{PYTHON_USEDEP\}/${multi_usedep}} )" )
98 fi
99 done
100
101 --
102 2.25.2