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 v2] python-any-r1.eclass: Declare PYTHON_REQUIRED_USE to catch errors
Date: Sun, 21 Jul 2019 17:18:48
Message-Id: 20190721171838.13549-1-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH] python-any-r1.eclass: Declare PYTHON_REQUIRED_USE to catch errors by "Michał Górny"
1 Changes in v2:
2 - declare PYTHON_REQUIRED_USE only if not declared already
3 (fixes issue when eclass is inherited multiple times)
4
5 Signed-off-by: Michał Górny <mgorny@g.o>
6 ---
7 eclass/python-any-r1.eclass | 8 +++++++-
8 1 file changed, 7 insertions(+), 1 deletion(-)
9
10 diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
11 index 7a91507a600f..db8f23647cd1 100644
12 --- a/eclass/python-any-r1.eclass
13 +++ b/eclass/python-any-r1.eclass
14 @@ -1,4 +1,4 @@
15 -# Copyright 1999-2018 Gentoo Foundation
16 +# Copyright 1999-2019 Gentoo Authors
17 # Distributed under the terms of the GNU General Public License v2
18
19 # @ECLASS: python-any-r1.eclass
20 @@ -171,6 +171,12 @@ _python_any_set_globals() {
21 PYTHON_DEPS=${deps}
22 readonly PYTHON_DEPS
23 fi
24 +
25 + if [[ ! ${PYTHON_REQUIRED_USE+1} ]]; then
26 + # fake var to catch mistaken usage
27 + PYTHON_REQUIRED_USE='I-DO-NOT-EXIST-IN-PYTHON-ANY-R1'
28 + readonly PYTHON_REQUIRED_USE
29 + fi
30 }
31 _python_any_set_globals
32 unset -f _python_any_set_globals
33 --
34 2.22.0