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 6/7] python-single-r1.eclass: Remove deprecated PYTHON_USEDEP API
Date: Sat, 30 Nov 2019 12:43:52
Message-Id: 20191130124126.169871-7-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/7] python-single-r1.eclass: New split usedep API by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/python-single-r1.eclass | 122 ++++-----------------------------
4 1 file changed, 13 insertions(+), 109 deletions(-)
5
6 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
7 index f042bf4e1167..438f25134c34 100644
8 --- a/eclass/python-single-r1.eclass
9 +++ b/eclass/python-single-r1.eclass
10 @@ -139,29 +139,6 @@ EXPORT_FUNCTIONS pkg_setup
11 # python_single_target_pypy? ( virtual/pypy[gdbm] )
12 # @CODE
13
14 -# @ECLASS-VARIABLE: PYTHON_USEDEP
15 -# @DESCRIPTION:
16 -# DEPRECATED. Use PYTHON_SINGLE_USEDEP or python_gen_cond_dep with
17 -# PYTHON_MULTI_USEDEP placeholder instead.
18 -#
19 -# This is an eclass-generated USE-dependency string which can be used to
20 -# depend on another Python package being built for the same Python
21 -# implementations.
22 -#
23 -# The generate USE-flag list is compatible with packages using python-r1,
24 -# python-single-r1 and python-distutils-ng eclasses. It must not be used
25 -# on packages using python.eclass.
26 -#
27 -# Example use:
28 -# @CODE
29 -# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
30 -# @CODE
31 -#
32 -# Example value:
33 -# @CODE
34 -# python_targets_python2_7(-)?,python_single_target_python3_4(+)?
35 -# @CODE
36 -
37 # @ECLASS-VARIABLE: PYTHON_SINGLE_USEDEP
38 # @DESCRIPTION:
39 # This is an eclass-generated USE-dependency string which can be used to
40 @@ -226,7 +203,6 @@ _python_single_set_globals() {
41
42 local flags_mt=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_targets_}" )
43 local flags=( "${_PYTHON_SUPPORTED_IMPLS[@]/#/python_single_target_}" )
44 - local unflags=( "${_PYTHON_UNSUPPORTED_IMPLS[@]/#/-python_single_target_}" )
45
46 if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
47 # if only one implementation is supported, use IUSE defaults
48 @@ -237,8 +213,6 @@ _python_single_set_globals() {
49 fi
50
51 local requse="^^ ( ${flags[*]} )"
52 - local optflags="${flags_mt[@]/%/(-)?},${unflags[@]/%/(-)},${flags[@]/%/(+)?}"
53 - local usedep="${optflags// /,}"
54 local single_flags="${flags[@]/%/(-)?}"
55 local single_usedep=${single_flags// /,}
56
57 @@ -276,13 +250,6 @@ _python_single_set_globals() {
58 die "PYTHON_REQUIRED_USE integrity check failed"
59 fi
60
61 - if [[ ${PYTHON_USEDEP} != "${usedep}" ]]; then
62 - eerror "PYTHON_USEDEP have changed between inherits!"
63 - eerror "Before: ${PYTHON_USEDEP}"
64 - eerror "Now : ${usedep}"
65 - die "PYTHON_USEDEP integrity check failed"
66 - fi
67 -
68 if [[ ${PYTHON_SINGLE_USEDEP} != "${single_usedep}" ]]; then
69 eerror "PYTHON_SINGLE_USEDEP have changed between inherits!"
70 eerror "Before: ${PYTHON_SINGLE_USEDEP}"
71 @@ -292,10 +259,8 @@ _python_single_set_globals() {
72 else
73 PYTHON_DEPS=${deps}
74 PYTHON_REQUIRED_USE=${requse}
75 - PYTHON_USEDEP=${usedep}
76 PYTHON_SINGLE_USEDEP=${single_usedep}
77 - readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_USEDEP \
78 - PYTHON_SINGLE_USEDEP
79 + readonly PYTHON_DEPS PYTHON_REQUIRED_USE PYTHON_SINGLE_USEDEP
80 fi
81 }
82 _python_single_set_globals
83 @@ -305,45 +270,29 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
84
85 # @FUNCTION: _python_gen_usedep
86 # @INTERNAL
87 -# @USAGE: <-s|-u> [<pattern>...]
88 +# @USAGE: [<pattern>...]
89 # @DESCRIPTION:
90 # Output a USE dependency string for Python implementations which
91 # are both in PYTHON_COMPAT and match any of the patterns passed
92 # as parameters to the function.
93 #
94 -# The first argument specifies USE-dependency type: '-s' for new-style
95 -# PYTHON_SINGLE_USEDEP, '-u' for backwards-compatible PYTHON_USEDEP.
96 -#
97 # The patterns can be either fnmatch-style patterns (matched via bash
98 # == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
99 # appropriately all enabled Python 2/3 implementations (alike
100 # python_is_python3). Remember to escape or quote the fnmatch patterns
101 # to prevent accidental shell filename expansion.
102 #
103 -# This is an internal function used to implement python_gen_cond_dep
104 -# and deprecated python_gen_usedep.
105 +# This is an internal function used to implement python_gen_cond_dep.
106 _python_gen_usedep() {
107 debug-print-function ${FUNCNAME} "${@}"
108
109 - local mode=${1}
110 - shift
111 local impl matches=()
112
113 for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
114 if _python_impl_matches "${impl}" "${@}"; then
115 - case ${mode} in
116 - -s)
117 - matches+=(
118 - "python_single_target_${impl}(-)?"
119 - )
120 - ;;
121 - -u)
122 - matches+=(
123 - "python_targets_${impl}(-)?"
124 - "python_single_target_${impl}(+)?"
125 - )
126 - ;;
127 - esac
128 + matches+=(
129 + "python_single_target_${impl}(-)?"
130 + )
131 fi
132 done
133
134 @@ -353,46 +302,6 @@ _python_gen_usedep() {
135 echo "${out// /,}"
136 }
137
138 -# @FUNCTION: python_gen_usedep
139 -# @USAGE: <pattern> [...]
140 -# @DESCRIPTION:
141 -# DEPRECATED. Please use python_gen_cond_dep instead.
142 -#
143 -# Output a USE dependency string for Python implementations which
144 -# are both in PYTHON_COMPAT and match any of the patterns passed
145 -# as parameters to the function.
146 -#
147 -# The patterns can be either fnmatch-style patterns (matched via bash
148 -# == operator against PYTHON_COMPAT values) or '-2' / '-3' to indicate
149 -# appropriately all enabled Python 2/3 implementations (alike
150 -# python_is_python3). Remember to escape or quote the fnmatch patterns
151 -# to prevent accidental shell filename expansion.
152 -#
153 -# When all implementations are requested, please use ${PYTHON_USEDEP}
154 -# instead. Please also remember to set an appropriate REQUIRED_USE
155 -# to avoid ineffective USE flags.
156 -#
157 -# Example:
158 -# @CODE
159 -# PYTHON_COMPAT=( python{2_7,3_4} )
160 -# DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep 'python2*')] )"
161 -# @CODE
162 -#
163 -# It will cause the dependency to look like:
164 -# @CODE
165 -# DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7(-)?,...] )"
166 -# @CODE
167 -python_gen_usedep() {
168 - debug-print-function ${FUNCNAME} "${@}"
169 -
170 - # output only once, during some reasonable phase
171 - # (avoid spamming cache regen runs)
172 - if [[ ${EBUILD_PHASE} == setup ]]; then
173 - eqawarn "python_gen_usedep() is deprecated. Please use python_gen_cond_dep instead."
174 - fi
175 - _python_gen_usedep -u "${@}"
176 -}
177 -
178 # @FUNCTION: python_gen_useflags
179 # @USAGE: [<pattern>...]
180 # @DESCRIPTION:
181 @@ -444,10 +353,9 @@ python_gen_useflags() {
182 # to prevent accidental shell filename expansion.
183 #
184 # In order to enforce USE constraints on the packages, verbatim
185 -# '${PYTHON_USEDEP}', '${PYTHON_SINGLE_USEDEP}'
186 -# and '${PYTHON_MULTI_USEDEP}' (quoted!) may be placed in the dependency
187 -# specification. It will get expanded within the function into a proper
188 -# USE dependency string.
189 +# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_MULTI_USEDEP}' (quoted!) may
190 +# be placed in the dependency specification. It will get expanded within
191 +# the function into a proper USE dependency string.
192 #
193 # Example:
194 # @CODE
195 @@ -473,15 +381,11 @@ python_gen_cond_dep() {
196
197 for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
198 if _python_impl_matches "${impl}" "${@}"; then
199 - # substitute ${PYTHON_USEDEP} if used
200 - # (since python_gen_usedep() will not return ${PYTHON_USEDEP}
201 - # the code is run at most once)
202 - if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
203 - local usedep=$(_python_gen_usedep -u "${@}")
204 - dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}}
205 - fi
206 + # substitute ${PYTHON_SINGLE_USEDEP} if used
207 + # (since python_gen_usedep() will not return
208 + # ${PYTHON_SINGLE_USEDEP}, the code is run at most once)
209 if [[ ${dep} == *'${PYTHON_SINGLE_USEDEP}'* ]]; then
210 - local usedep=$(_python_gen_usedep -s "${@}")
211 + local usedep=$(_python_gen_usedep "${@}")
212 dep=${dep//\$\{PYTHON_SINGLE_USEDEP\}/${usedep}}
213 fi
214 local multi_usedep="python_targets_${impl}(-)"
215 --
216 2.24.0