Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 09 Feb 2022 09:39:38
Message-Id: 1644396237.ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a.mgorny@gentoo
1 commit: ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 5 10:03:24 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 9 08:43:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ddd9cd63
7
8 python-utils-r1.eclass: Add QA check for obsolete PYTHON_COMPAT
9
10 Add a QA check that reports obsolete implementation in PYTHON_COMPAT
11 if ebuild has been modified in 2022 (based on copyright year).
12 Requested by sam.
13
14 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
15
16 eclass/python-utils-r1.eclass | 18 +++++++++++++++++-
17 1 file changed, 17 insertions(+), 1 deletion(-)
18
19 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
20 index 0703d81d9161..ab333aaf15eb 100644
21 --- a/eclass/python-utils-r1.eclass
22 +++ b/eclass/python-utils-r1.eclass
23 @@ -123,6 +123,8 @@ _python_set_impls() {
24 if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
25 die 'PYTHON_COMPAT must be an array.'
26 fi
27 +
28 + local obsolete=()
29 if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
30 for i in "${PYTHON_COMPAT[@]}"; do
31 # check for incorrect implementations
32 @@ -130,7 +132,10 @@ _python_set_impls() {
33 # please keep them in sync with _PYTHON_ALL_IMPLS
34 # and _PYTHON_HISTORICAL_IMPLS
35 case ${i} in
36 - jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
37 + pypy3|python2_7|python3_[89]|python3_10)
38 + ;;
39 + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
40 + obsolete+=( "${i}" )
41 ;;
42 *)
43 if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
44 @@ -144,6 +149,17 @@ _python_set_impls() {
45 done
46 fi
47
48 + if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then
49 + # complain if people don't clean up old impls while touching
50 + # the ebuilds recently. use the copyright year to infer last
51 + # modification
52 + # NB: this check doesn't have to work reliably
53 + if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then
54 + eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:"
55 + eqawarn " ${obsolete[*]}"
56 + fi
57 + fi
58 +
59 local supp=() unsupp=()
60
61 for i in "${_PYTHON_ALL_IMPLS[@]}"; do