Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier.
Date: Sun, 17 Mar 2013 22:33:14
Message-Id: 1363559630-17431-2-git-send-email-mgorny@gentoo.org
1 The PYTHON_COMPAT_OVERRIDE can be set in the environment to enforce
2 a different set of Python implementations than one being intersection
3 of PYTHON_COMPAT and PYTHON_TARGETS.
4
5 Due to technical limitations, the variable influences only the list
6 of implementations actually used. USE flags, dependencies and other
7 metadata variables are not modified.
8 ---
9 gx86/eclass/python-r1.eclass | 34 ++++++++++++++++++++++++++++++++++
10 1 file changed, 34 insertions(+)
11
12 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
13 index 99bd240..c060c24 100644
14 --- a/gx86/eclass/python-r1.eclass
15 +++ b/gx86/eclass/python-r1.eclass
16 @@ -74,6 +74,25 @@ if ! declare -p PYTHON_COMPAT &>/dev/null; then
17 fi
18 fi
19
20 +# @ECLASS-VARIABLE: PYTHON_COMPAT_OVERRIDE
21 +# @INTERNAL
22 +# @DESCRIPTION:
23 +# This variable can be used when working with ebuilds to override
24 +# the in-ebuild PYTHON_COMPAT. It is a string listing all
25 +# the implementations which package will be built for. It need be
26 +# specified in the calling environment, and not in ebuilds.
27 +#
28 +# It should be noted that in order to preserve metadata immutability,
29 +# PYTHON_COMPAT_OVERRIDE does not affect IUSE nor dependencies.
30 +# The state of PYTHON_TARGETS is ignored, and all the implementations
31 +# in PYTHON_COMPAT_OVERRIDE are built. Dependencies need to be satisfied
32 +# manually.
33 +#
34 +# Example:
35 +# @CODE
36 +# PYTHON_COMPAT_OVERRIDE='pypy2_0 python3_3' emerge -1v dev-python/foo
37 +# @CODE
38 +
39 # @ECLASS-VARIABLE: PYTHON_REQ_USE
40 # @DEFAULT_UNSET
41 # @DESCRIPTION:
42 @@ -576,6 +595,21 @@ _python_check_USE_PYTHON() {
43 # @DESCRIPTION:
44 # Set up the enabled implementation list.
45 _python_obtain_impls() {
46 + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
47 + if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
48 + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
49 + ewarn "implementations will be enabled:"
50 + ewarn
51 + ewarn " ${PYTHON_COMPAT_OVERRIDE}"
52 + ewarn
53 + ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored."
54 + _PYTHON_COMPAT_OVERRIDE_WARNED=1
55 + fi
56 +
57 + MULTIBUILD_VARIANTS=( ${PYTHON_COMPAT_OVERRIDE} )
58 + return
59 + fi
60 +
61 _python_validate_useflags
62 _python_check_USE_PYTHON
63
64 --
65 1.8.1.5

Replies