---
gx86/eclass/python-r1.eclass | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index b059a3b..d7cdfa8 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -387,3 +387,28 @@ python_foreach_impl() {
fi
done
}
+
+# @FUNCTION: python_export_best
+# @USAGE: [<variable>...]
+# @DESCRIPTION:
+# Find the best (most preferred) Python implementation enabled
+# and export given variables for it. If no variables are provided,
+# EPYTHON & PYTHON will be exported.
+python_export_best() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON
+
+ local impl best
+ for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
+ if has "${impl}" "${PYTHON_COMPAT[@]}" && use
"python_targets_${impl}"
+ then
+ best=${impl}
+ fi
+ done
+
+ [[ ${best+1} ]] || die "python_export_best(): no implementation found!"
+
+ debug-print "${FUNCNAME}: Best implementation is: ${impl}"
+ python_export "${impl}" "${@}"
+}
--
1.7.12.4