commit: fad409ec352330b9ad88e82dc67bca029c866531
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 9 08:14:04 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Aug 9 08:14:04 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=fad409ec
eclass/python-utils-r1.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0caece1344..1b1f6b4d4b 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: <pattern>...
+# @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:
@@ -1197,8 +1231,8 @@ python_fix_shebang() {
# @FUNCTION: _python_check_locale_sanity
# @USAGE: <locale>
-# @INTERNAL
# @RETURN: 0 if sane, 1 otherwise
+# @INTERNAL
# @DESCRIPTION:
# Check whether the specified locale sanely maps between lowercase
# and uppercase ASCII characters.