From 3cf7c3ef441822c889356fd1812ebf2944a59851 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 25 Aug 2020 10:45:55 +0100 Subject: gentoo resync : 25.08.2020 --- eclass/python-utils-r1.eclass | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'eclass/python-utils-r1.eclass') diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index 9bad72a77e98..87cb662c64fd 100644 --- a/eclass/python-utils-r1.eclass +++ b/eclass/python-utils-r1.eclass @@ -45,6 +45,18 @@ _PYTHON_ALL_IMPLS=( ) readonly _PYTHON_ALL_IMPLS +# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS +# @INTERNAL +# @DESCRIPTION: +# All historical Python implementations that are no longer supported. +_PYTHON_HISTORICAL_IMPLS=( + jython2_7 + pypy pypy1_{8,9} pypy2_0 + python2_{5,6} + python3_{1,2,3,4,5} +) +readonly _PYTHON_HISTORICAL_IMPLS + # @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT # @INTERNAL # @DESCRIPTION: @@ -89,6 +101,28 @@ _python_impl_supported() { esac } +# @FUNCTION: _python_verify_patterns +# @USAGE: ... +# @INTERNAL +# @DESCRIPTION: +# Verify whether the patterns passed to the eclass function are correct +# (i.e. can match any valid implementation). Dies on wrong pattern. +_python_verify_patterns() { + debug-print-function ${FUNCNAME} "${@}" + + local impl pattern + for pattern; do + [[ ${pattern} == -[23] ]] && continue + + for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}" + do + [[ ${impl} == ${pattern/./_} ]] && continue 2 + done + + die "Invalid implementation pattern: ${pattern}" + done +} + # @FUNCTION: _python_set_impls # @INTERNAL # @DESCRIPTION: -- cgit v1.2.3