Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 4/5] python-single-r1.eclass: Support PYTHON_COMPAT_OVERRIDE
Date: Thu, 17 Dec 2015 22:05:56
Message-Id: 1450389778-10144-5-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/5] python*-r1: commonize PYTHON_COMPAT handling by "Michał Górny"
1 ---
2 eclass/python-single-r1.eclass | 36 ++++++++++++++++++++++++++++++++++++
3 1 file changed, 36 insertions(+)
4
5 diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
6 index 4c4f057..4d5026f 100644
7 --- a/eclass/python-single-r1.eclass
8 +++ b/eclass/python-single-r1.eclass
9 @@ -96,6 +96,25 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
10 # PYTHON_COMPAT=( python2_7 python3_{3,4} )
11 # @CODE
12
13 +# @ECLASS-VARIABLE: PYTHON_COMPAT_OVERRIDE
14 +# @INTERNAL
15 +# @DESCRIPTION:
16 +# This variable can be used when working with ebuilds to override
17 +# the in-ebuild PYTHON_COMPAT. It is a string naming the implementation
18 +# which package will be built for. It needs to be specified
19 +# in the calling environment, and not in ebuilds.
20 +#
21 +# It should be noted that in order to preserve metadata immutability,
22 +# PYTHON_COMPAT_OVERRIDE does not affect IUSE nor dependencies.
23 +# The state of PYTHON_TARGETS and PYTHON_SINGLE_TARGET is ignored,
24 +# and the implementation in PYTHON_COMPAT_OVERRIDE is built instead.
25 +# Dependencies need to be satisfied manually.
26 +#
27 +# Example:
28 +# @CODE
29 +# PYTHON_COMPAT_OVERRIDE='pypy' emerge -1v dev-python/bar
30 +# @CODE
31 +
32 # @ECLASS-VARIABLE: PYTHON_REQ_USE
33 # @DEFAULT_UNSET
34 # @DESCRIPTION:
35 @@ -401,6 +420,23 @@ python_setup() {
36
37 unset EPYTHON
38
39 + # support developer override
40 + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
41 + local impls=( ${PYTHON_COMPAT_OVERRIDE} )
42 + [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-single-r1"
43 +
44 + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
45 + ewarn "implementation will be used:"
46 + ewarn
47 + ewarn " ${PYTHON_COMPAT_OVERRIDE}"
48 + ewarn
49 + ewarn "Dependencies won't be satisfied, and PYTHON_SINGLE_TARGET flags will be ignored."
50 +
51 + python_export "${impls[0]}" EPYTHON PYTHON
52 + python_wrapper_setup
53 + return
54 + fi
55 +
56 if [[ ${#_PYTHON_SUPPORTED_IMPLS[@]} -eq 1 ]]; then
57 if use "python_targets_${_PYTHON_SUPPORTED_IMPLS[0]}"; then
58 # Only one supported implementation, enable it explicitly
59 --
60 2.6.4