1 |
--- |
2 |
gx86/eclass/python-r1.eclass | 25 +++++++++++++++++++++++++ |
3 |
1 file changed, 25 insertions(+) |
4 |
|
5 |
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass |
6 |
index b059a3b..d7cdfa8 100644 |
7 |
--- a/gx86/eclass/python-r1.eclass |
8 |
+++ b/gx86/eclass/python-r1.eclass |
9 |
@@ -387,3 +387,28 @@ python_foreach_impl() { |
10 |
fi |
11 |
done |
12 |
} |
13 |
+ |
14 |
+# @FUNCTION: python_export_best |
15 |
+# @USAGE: [<variable>...] |
16 |
+# @DESCRIPTION: |
17 |
+# Find the best (most preferred) Python implementation enabled |
18 |
+# and export given variables for it. If no variables are provided, |
19 |
+# EPYTHON & PYTHON will be exported. |
20 |
+python_export_best() { |
21 |
+ debug-print-function ${FUNCNAME} "${@}" |
22 |
+ |
23 |
+ [[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON |
24 |
+ |
25 |
+ local impl best |
26 |
+ for impl in "${_PYTHON_ALL_IMPLS[@]}"; do |
27 |
+ if has "${impl}" "${PYTHON_COMPAT[@]}" && use "python_targets_${impl}" |
28 |
+ then |
29 |
+ best=${impl} |
30 |
+ fi |
31 |
+ done |
32 |
+ |
33 |
+ [[ ${best+1} ]] || die "python_export_best(): no implementation found!" |
34 |
+ |
35 |
+ debug-print "${FUNCNAME}: Best implementation is: ${impl}" |
36 |
+ python_export "${impl}" "${@}" |
37 |
+} |
38 |
-- |
39 |
1.7.12.4 |