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 2/7] python-r1.eclass: Move PYTHON_COMPAT_OVERRIDE warning into flag check
Date: Sat, 20 May 2017 13:35:47
Message-Id: 20170520133044.9692-3-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] python-r1.eclass: any-of dep API support by "Michał Górny"
1 Move the PYTHON_COMPAT_OVERRIDE warning from _python_obtain_impls()
2 to _python_validate_useflags(). Since the latter function is the only
3 point where the former is called, this is a purely cosmetic change at
4 the moment. However, it makes it possible to reuse the warning in
5 additional places without the necessity of setting MULTIBUILD_VARIANTS.
6 ---
7 eclass/python-r1.eclass | 31 ++++++++++++++++++-------------
8 1 file changed, 18 insertions(+), 13 deletions(-)
9
10 diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
11 index 5eaa802e06b9..ae9e3806e729 100644
12 --- a/eclass/python-r1.eclass
13 +++ b/eclass/python-r1.eclass
14 @@ -242,10 +242,25 @@ if [[ ! ${_PYTHON_R1} ]]; then
15 # @FUNCTION: _python_validate_useflags
16 # @INTERNAL
17 # @DESCRIPTION:
18 -# Enforce the proper setting of PYTHON_TARGETS.
19 +# Enforce the proper setting of PYTHON_TARGETS, if PYTHON_COMPAT_OVERRIDE
20 +# is not in effect. If it is, just warn that the flags will be ignored.
21 _python_validate_useflags() {
22 debug-print-function ${FUNCNAME} "${@}"
23
24 + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
25 + if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
26 + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
27 + ewarn "implementations will be enabled:"
28 + ewarn
29 + ewarn " ${PYTHON_COMPAT_OVERRIDE}"
30 + ewarn
31 + ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored."
32 + _PYTHON_COMPAT_OVERRIDE_WARNED=1
33 + fi
34 + # we do not use flags with PCO
35 + return
36 + fi
37 +
38 local i
39
40 for i in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
41 @@ -490,23 +505,13 @@ python_copy_sources() {
42 # @DESCRIPTION:
43 # Set up the enabled implementation list.
44 _python_obtain_impls() {
45 - if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
46 - if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
47 - ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
48 - ewarn "implementations will be enabled:"
49 - ewarn
50 - ewarn " ${PYTHON_COMPAT_OVERRIDE}"
51 - ewarn
52 - ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored."
53 - _PYTHON_COMPAT_OVERRIDE_WARNED=1
54 - fi
55 + _python_validate_useflags
56
57 + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
58 MULTIBUILD_VARIANTS=( ${PYTHON_COMPAT_OVERRIDE} )
59 return
60 fi
61
62 - _python_validate_useflags
63 -
64 MULTIBUILD_VARIANTS=()
65
66 local impl
67 --
68 2.13.0