Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 1/5] distutils-r1.eclass: Remove support for EAPIs prior to 6
Date: Thu, 08 Apr 2021 07:43:26
Message-Id: 20210408074311.109594-1-mgorny@gentoo.org
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/distutils-r1.eclass | 84 ++++++--------------------------------
4 1 file changed, 12 insertions(+), 72 deletions(-)
5
6 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
7 index 24c5653aad06..2994993e63e8 100644
8 --- a/eclass/distutils-r1.eclass
9 +++ b/eclass/distutils-r1.eclass
10 @@ -7,7 +7,7 @@
11 # @AUTHOR:
12 # Author: Michał Górny <mgorny@g.o>
13 # Based on the work of: Krzysztof Pawlik <nelchael@g.o>
14 -# @SUPPORTED_EAPIS: 5 6 7
15 +# @SUPPORTED_EAPIS: 6 7
16 # @BLURB: A simple eclass to build Python packages using distutils.
17 # @DESCRIPTION:
18 # A simple eclass providing functions to build Python packages using
19 @@ -44,10 +44,10 @@
20 # https://dev.gentoo.org/~mgorny/python-guide/
21
22 case "${EAPI:-0}" in
23 - 0|1|2|3|4)
24 + [0-5])
25 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
26 ;;
27 - 5|6|7)
28 + [6-7])
29 ;;
30 *)
31 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
32 @@ -97,8 +97,7 @@ esac
33
34 if [[ ! ${_DISTUTILS_R1} ]]; then
35
36 -[[ ${EAPI} == [456] ]] && inherit eutils
37 -[[ ${EAPI} == [56] ]] && inherit xdg-utils
38 +[[ ${EAPI} == 6 ]] && inherit eutils xdg-utils
39 inherit multiprocessing toolchain-funcs
40
41 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
42 @@ -146,7 +145,7 @@ _distutils_set_globals() {
43 fi
44
45 RDEPEND="${PYTHON_DEPS} ${rdep}"
46 - if [[ ${EAPI} != [56] ]]; then
47 + if [[ ${EAPI} != 6 ]]; then
48 BDEPEND="${PYTHON_DEPS} ${bdep}"
49 else
50 DEPEND="${PYTHON_DEPS} ${bdep}"
51 @@ -202,26 +201,6 @@ unset -f _distutils_set_globals
52 # HTML_DOCS=( doc/html/. )
53 # @CODE
54
55 -# @ECLASS-VARIABLE: EXAMPLES
56 -# @DEFAULT_UNSET
57 -# @DESCRIPTION:
58 -# OBSOLETE: this variable is deprecated and banned in EAPI 6
59 -#
60 -# An array containing examples installed into 'examples' doc
61 -# subdirectory. The files and directories listed there must exist
62 -# in the directory from which distutils-r1_python_install_all() is run
63 -# (${S} by default).
64 -#
65 -# The 'examples' subdirectory will be marked not to be compressed
66 -# automatically.
67 -#
68 -# If unset, no examples will be installed.
69 -#
70 -# Example:
71 -# @CODE
72 -# EXAMPLES=( examples/. demos/. )
73 -# @CODE
74 -
75 # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
76 # @DEFAULT_UNSET
77 # @DESCRIPTION:
78 @@ -369,7 +348,7 @@ distutils_enable_sphinx() {
79 python_compile_all() { sphinx_compile_all; }
80
81 IUSE+=" doc"
82 - if [[ ${EAPI} == [56] ]]; then
83 + if [[ ${EAPI} == 6 ]]; then
84 DEPEND+=" doc? ( ${deps} )"
85 else
86 BDEPEND+=" doc? ( ${deps} )"
87 @@ -448,7 +427,7 @@ distutils_enable_tests() {
88 if [[ -n ${test_deps} ]]; then
89 IUSE+=" test"
90 RESTRICT+=" !test? ( test )"
91 - if [[ ${EAPI} == [56] ]]; then
92 + if [[ ${EAPI} == 6 ]]; then
93 DEPEND+=" test? ( ${test_deps} )"
94 else
95 BDEPEND+=" test? ( ${test_deps} )"
96 @@ -480,9 +459,6 @@ esetup.py() {
97
98 [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
99
100 - local die_args=()
101 - [[ ${EAPI} != [45] ]] && die_args+=( -n )
102 -
103 [[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg
104
105 local setup_py=( setup.py )
106 @@ -494,11 +470,11 @@ esetup.py() {
107 set -- "${EPYTHON}" "${setup_py[@]}" "${mydistutilsargs[@]}" "${@}"
108
109 echo "${@}" >&2
110 - "${@}" || die "${die_args[@]}"
111 + "${@}" || die -n
112 local ret=${?}
113
114 if [[ ${BUILD_DIR} ]]; then
115 - rm "${HOME}"/.pydistutils.cfg || die "${die_args[@]}"
116 + rm "${HOME}"/.pydistutils.cfg || die -n
117 fi
118
119 return ${ret}
120 @@ -621,12 +597,7 @@ distutils-r1_python_prepare_all() {
121 debug-print-function ${FUNCNAME} "${@}"
122
123 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
124 - if [[ ${EAPI} != [45] ]]; then
125 - default
126 - else
127 - [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
128 - epatch_user
129 - fi
130 + default
131 fi
132
133 # by default, use in-source build if python_prepare() is used
134 @@ -648,24 +619,6 @@ distutils-r1_python_prepare_all() {
135 _DISTUTILS_DEFAULT_CALLED=1
136 }
137
138 -# @FUNCTION: distutils-r1_python_prepare
139 -# @DESCRIPTION:
140 -# The default python_prepare(). A no-op.
141 -distutils-r1_python_prepare() {
142 - debug-print-function ${FUNCNAME} "${@}"
143 -
144 - [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
145 -}
146 -
147 -# @FUNCTION: distutils-r1_python_configure
148 -# @DESCRIPTION:
149 -# The default python_configure(). A no-op.
150 -distutils-r1_python_configure() {
151 - debug-print-function ${FUNCNAME} "${@}"
152 -
153 - [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
154 -}
155 -
156 # @FUNCTION: _distutils-r1_create_setup_cfg
157 # @INTERNAL
158 # @DESCRIPTION:
159 @@ -941,16 +894,6 @@ distutils-r1_python_install_all() {
160 debug-print-function ${FUNCNAME} "${@}"
161
162 einstalldocs
163 -
164 - if declare -p EXAMPLES &>/dev/null; then
165 - [[ ${EAPI} != [45] ]] && die "EXAMPLES are banned in EAPI ${EAPI}"
166 -
167 - (
168 - docinto examples
169 - dodoc -r "${EXAMPLES[@]}"
170 - )
171 - docompress -x "/usr/share/doc/${PF}/examples"
172 - fi
173 }
174
175 # @FUNCTION: distutils-r1_run_phase
176 @@ -1081,10 +1024,7 @@ distutils-r1_src_prepare() {
177 fi
178
179 if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
180 - local cmd=die
181 - [[ ${EAPI} == [45] ]] && cmd=eqawarn
182 -
183 - "${cmd}" "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all"
184 + die "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all"
185 fi
186
187 if declare -f python_prepare >/dev/null; then
188 @@ -1094,7 +1034,7 @@ distutils-r1_src_prepare() {
189
190 distutils-r1_src_configure() {
191 python_export_utf8_locale
192 - [[ ${EAPI} == [56] ]] && xdg_environment_reset # Bug 577704
193 + [[ ${EAPI} == 6 ]] && xdg_environment_reset # Bug 577704
194
195 if declare -f python_configure >/dev/null; then
196 _distutils-r1_run_foreach_impl python_configure
197 --
198 2.31.1

Replies