summaryrefslogtreecommitdiff
path: root/eclass/python-utils-r1.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /eclass/python-utils-r1.eclass
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass34
1 files changed, 34 insertions, 0 deletions
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: <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: