python-r1.eclass: python_gen_cond_dep, use _python_impl_matches()
authorMichał Górny <mgorny@gentoo.org>
Wed, 10 May 2017 15:24:05 +0000 (17:24 +0200)
committerMichał Górny <mgorny@gentoo.org>
Tue, 16 May 2017 17:11:33 +0000 (19:11 +0200)
eclass/python-r1.eclass

index 7ec77acd8665832e502b9feaf876dc66791c9b86..2618c6f570330bcb223e21cf99fb68828bec44a2 100644 (file)
@@ -364,27 +364,22 @@ python_gen_useflags() {
 python_gen_cond_dep() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       local impl pattern
-       local matches=()
-
+       local impl matches=()
        local dep=${1}
        shift
 
        for impl in "${_PYTHON_SUPPORTED_IMPLS[@]}"; do
-               for pattern; do
-                       if [[ ${impl} == ${pattern} ]]; then
-                               # substitute ${PYTHON_USEDEP} if used
-                               # (since python_gen_usedep() will not return ${PYTHON_USEDEP}
-                               #  the code is run at most once)
-                               if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
-                                       local usedep=$(python_gen_usedep "${@}")
-                                       dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}}
-                               fi
-
-                               matches+=( "python_targets_${impl}? ( ${dep} )" )
-                               break
+               if _python_impl_matches "${impl}" "${@}"; then
+                       # substitute ${PYTHON_USEDEP} if used
+                       # (since python_gen_usedep() will not return ${PYTHON_USEDEP}
+                       #  the code is run at most once)
+                       if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
+                               local usedep=$(python_gen_usedep "${@}")
+                               dep=${dep//\$\{PYTHON_USEDEP\}/${usedep}}
                        fi
-               done
+
+                       matches+=( "python_targets_${impl}? ( ${dep} )" )
+               fi
        done
 
        echo "${matches[@]}"