summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/distutils-r1.eclass5
-rw-r--r--eclass/python-r1.eclass35
-rw-r--r--eclass/python-single-r1.eclass18
-rw-r--r--eclass/python-utils-r1.eclass22
4 files changed, 36 insertions, 44 deletions
diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index a1b840d9cc68..fd3dffeac31c 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -333,9 +333,8 @@ unset -f _distutils_set_globals
# (allowing any implementation). If multiple values are specified,
# implementations matching any of the patterns will be accepted.
#
-# The patterns are fnmatch-style patterns (matched via bash == operator
-# against PYTHON_COMPAT values). Remember to escape or quote the fnmatch
-# patterns to prevent accidental shell filename expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# If the restriction needs to apply conditionally to a USE flag,
# the variable should be set conditionally as well (e.g. in an early
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index bb851e167617..bf2fd62fdcba 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -289,11 +289,6 @@ _python_validate_useflags() {
# are both in PYTHON_COMPAT and match any of the patterns passed
# as parameters to the function.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
-#
# This is an internal function used to implement python_gen_cond_dep.
_python_gen_usedep() {
debug-print-function ${FUNCNAME} "${@}"
@@ -322,10 +317,8 @@ _python_gen_usedep() {
# are both in PYTHON_COMPAT and match any of the patterns passed
# as parameters to the function.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# Example:
# @CODE
@@ -359,10 +352,8 @@ python_gen_useflags() {
# of Python implementations which are both in PYTHON_COMPAT and match
# any of the patterns passed as the remaining parameters.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# In order to enforce USE constraints on the packages, verbatim
# '${PYTHON_USEDEP}' (quoted!) may be placed in the dependency
@@ -423,10 +414,8 @@ python_gen_cond_dep() {
# patterns are passed, the output dependencies will be generated only
# for the implementations matching them.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# Use this function when you need to request different USE flags
# on the Python interpreter depending on package's USE flags. If you
@@ -479,10 +468,8 @@ python_gen_impl_dep() {
#
# Optionally, patterns may be specified to restrict the dependency to
# a subset of Python implementations supported by the ebuild.
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# This should be used along with an appropriate python_check_deps()
# that checks which of the any-of blocks were matched, and python_setup
@@ -669,10 +656,8 @@ python_foreach_impl() {
# The python_check_deps() function in the any-of mode needs to be
# accompanied by appropriate any-of dependencies.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# This function needs to be used when Python is being called outside
# of python_foreach_impl calls (e.g. for shared processes like doc
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 0e9a16a47d0e..998e6faad841 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -266,10 +266,8 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
# are both in PYTHON_COMPAT and match any of the patterns passed
# as parameters to the function.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# Example:
# @CODE
@@ -303,10 +301,8 @@ python_gen_useflags() {
# of Python implementations which are both in PYTHON_COMPAT and match
# any of the patterns passed as the remaining parameters.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# In order to enforce USE constraints on the packages, verbatim
# '${PYTHON_SINGLE_USEDEP}' and '${PYTHON_USEDEP}' (quoted!) may
@@ -359,10 +355,8 @@ python_gen_cond_dep() {
# patterns are passed, the output dependencies will be generated only
# for the implementations matching them.
#
-# The patterns are fnmatch-style patterns (matched via bash
-# == operator against PYTHON_COMPAT values). Remember to escape
-# or quote the fnmatch patterns to prevent accidental shell filename
-# expansion.
+# For the pattern syntax, please see _python_impl_matches
+# in python-utils-r1.eclass.
#
# Use this function when you need to request different USE flags
# on the Python interpreter depending on package's USE flags. If you
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 9dc23bf9bfb0..0703d81d9161 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -82,7 +82,11 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
- [[ ${pattern} == -[23] ]] && continue
+ case ${pattern} in
+ -[23]|3.[89]|3.10)
+ continue
+ ;;
+ esac
for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
do
@@ -190,12 +194,14 @@ _python_set_impls() {
# Matches if no patterns are provided.
#
# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
-# are fnmatch-style.
+# can either be fnmatch-style or stdlib versions, e.g. "3.8", "3.9".
+# In the latter case, pypy3 will match if there is at least one pypy3
+# version matching the stdlib version.
_python_impl_matches() {
[[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
[[ ${#} -eq 1 ]] && return 0
- local impl=${1} pattern
+ local impl=${1/./_} pattern
shift
for pattern; do
@@ -218,9 +224,17 @@ _python_impl_matches() {
fi
return 0
;;
+ 3.8)
+ # the only unmasked pypy3 version is pypy3.8 atm
+ [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
+ return 0
+ ;;
+ 3.9|3.10)
+ [[ ${impl} == python${pattern/./_} ]] && return 0
+ ;;
*)
# unify value style to allow lax matching
- [[ ${impl/./_} == ${pattern/./_} ]] && return 0
+ [[ ${impl} == ${pattern/./_} ]] && return 0
;;
esac
done