1 |
commit: 8b2a03095469242427067911fd4bc467173753c1 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 12 22:20:26 2015 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Dec 22 22:12:23 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b2a0309 |
7 |
|
8 |
python-any-r1.eclass: Support PYTHON_COMPAT_OVERRIDE |
9 |
|
10 |
eclass/python-any-r1.eclass | 35 +++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 35 insertions(+) |
12 |
|
13 |
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass |
14 |
index dbfeded..99aac73 100644 |
15 |
--- a/eclass/python-any-r1.eclass |
16 |
+++ b/eclass/python-any-r1.eclass |
17 |
@@ -72,6 +72,24 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then |
18 |
# PYTHON_COMPAT=( python{2_5,2_6,2_7} ) |
19 |
# @CODE |
20 |
|
21 |
+# @ECLASS-VARIABLE: PYTHON_COMPAT_OVERRIDE |
22 |
+# @INTERNAL |
23 |
+# @DESCRIPTION: |
24 |
+# This variable can be used when working with ebuilds to override |
25 |
+# the in-ebuild PYTHON_COMPAT. It is a string naming the implementation |
26 |
+# which will be used to build the package. It needs to be specified |
27 |
+# in the calling environment, and not in ebuilds. |
28 |
+# |
29 |
+# It should be noted that in order to preserve metadata immutability, |
30 |
+# PYTHON_COMPAT_OVERRIDE does not affect dependencies. The value of |
31 |
+# EPYTHON and eselect-python preferences are ignored. Dependencies need |
32 |
+# to be satisfied manually. |
33 |
+# |
34 |
+# Example: |
35 |
+# @CODE |
36 |
+# PYTHON_COMPAT_OVERRIDE='pypy' emerge -1v dev-python/bar |
37 |
+# @CODE |
38 |
+ |
39 |
# @ECLASS-VARIABLE: PYTHON_REQ_USE |
40 |
# @DEFAULT_UNSET |
41 |
# @DESCRIPTION: |
42 |
@@ -253,6 +271,23 @@ _python_EPYTHON_supported() { |
43 |
python_setup() { |
44 |
debug-print-function ${FUNCNAME} "${@}" |
45 |
|
46 |
+ # support developer override |
47 |
+ if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then |
48 |
+ local impls=( ${PYTHON_COMPAT_OVERRIDE} ) |
49 |
+ [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-any-r1" |
50 |
+ |
51 |
+ ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python" |
52 |
+ ewarn "implementation will be used:" |
53 |
+ ewarn |
54 |
+ ewarn " ${PYTHON_COMPAT_OVERRIDE}" |
55 |
+ ewarn |
56 |
+ ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored." |
57 |
+ |
58 |
+ python_export "${impls[0]}" EPYTHON PYTHON |
59 |
+ python_wrapper_setup |
60 |
+ return |
61 |
+ fi |
62 |
+ |
63 |
# first, try ${EPYTHON}... maybe it's good enough for us. |
64 |
if [[ ${EPYTHON} ]]; then |
65 |
if _python_EPYTHON_supported "${EPYTHON}"; then |