Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 22 Dec 2015 22:12:46
Message-Id: 1450822343.4a1560e50bfa935eacec648af6310dd914ff2489.mgorny@gentoo
1 commit: 4a1560e50bfa935eacec648af6310dd914ff2489
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 12 22:21:11 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=4a1560e5
7
8 python-single-r1.eclass: Support PYTHON_COMPAT_OVERRIDE
9
10 eclass/python-single-r1.eclass | 36 ++++++++++++++++++++++++++++++++++++
11 1 file changed, 36 insertions(+)
12
13 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
14 index 4c4f057..4d5026f 100644
15 --- a/eclass/python-single-r1.eclass
16 +++ b/eclass/python-single-r1.eclass
17 @@ -96,6 +96,25 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
18 # PYTHON_COMPAT=( python2_7 python3_{3,4} )
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 package will be built for. 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 IUSE nor dependencies.
31 +# The state of PYTHON_TARGETS and PYTHON_SINGLE_TARGET is ignored,
32 +# and the implementation in PYTHON_COMPAT_OVERRIDE is built instead.
33 +# Dependencies need to be satisfied manually.
34 +#
35 +# Example:
36 +# @CODE
37 +# PYTHON_COMPAT_OVERRIDE='pypy' emerge -1v dev-python/bar
38 +# @CODE
39 +
40 # @ECLASS-VARIABLE: PYTHON_REQ_USE
41 # @DEFAULT_UNSET
42 # @DESCRIPTION:
43 @@ -401,6 +420,23 @@ python_setup() {
44
45 unset EPYTHON
46
47 + # support developer override
48 + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
49 + local impls=( ${PYTHON_COMPAT_OVERRIDE} )
50 + [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-single-r1"
51 +
52 + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
53 + ewarn "implementation will be used:"
54 + ewarn
55 + ewarn " ${PYTHON_COMPAT_OVERRIDE}"
56 + ewarn
57 + ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored."
58 +
59 + python_export "${impls[0]}" EPYTHON PYTHON
60 + python_wrapper_setup
61 + return
62 + fi
63 +
64 if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
65 if use "python_targets_${_PYTHON_SUPPORTED_IMPLS[0]}"; then
66 # Only one supported implementation, enable it explicitly