diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-02-05 11:03:24 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-02-09 09:43:57 +0100 |
commit | ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a (patch) | |
tree | 48e44300adf07ccc761fbbc7ddb3fd034bde8c2b /eclass | |
parent | python-any-r1.eclass: Do not test EPYTHON twice (diff) | |
download | gentoo-ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a.tar.gz gentoo-ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a.tar.bz2 gentoo-ddd9cd63e860ce71ad5f92e80a3e6e4be901af8a.zip |
python-utils-r1.eclass: Add QA check for obsolete PYTHON_COMPAT
Add a QA check that reports obsolete implementation in PYTHON_COMPAT
if ebuild has been modified in 2022 (based on copyright year).
Requested by sam.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/python-utils-r1.eclass | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 0703d81d9161..ab333aaf15eb 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -123,6 +123,8 @@ _python_set_impls() { if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then die 'PYTHON_COMPAT must be an array.' fi + + local obsolete=() if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then for i in "${PYTHON_COMPAT[@]}"; do # check for incorrect implementations @@ -130,7 +132,10 @@ _python_set_impls() { # please keep them in sync with _PYTHON_ALL_IMPLS # and _PYTHON_HISTORICAL_IMPLS case ${i} in - jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10) + pypy3|python2_7|python3_[89]|python3_10) + ;; + jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7]) + obsolete+=( "${i}" ) ;; *) if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \ @@ -144,6 +149,17 @@ _python_set_impls() { done fi + if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then + # complain if people don't clean up old impls while touching + # the ebuilds recently. use the copyright year to infer last + # modification + # NB: this check doesn't have to work reliably + if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then + eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:" + eqawarn " ${obsolete[*]}" + fi + fi + local supp=() unsupp=() for i in "${_PYTHON_ALL_IMPLS[@]}"; do |