Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-python@l.g.o, python@g.o
Subject: [gentoo-python] Re: [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier.
Date: Sun, 17 Mar 2013 23:37:58
Message-Id: CAJ0EP42RSg5FseDMOVeMusKC8iRt7kC9YZtG=NkcAWoX6cU0qw@mail.gmail.com
In Reply to: [gentoo-python] [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier. by "Michał Górny"
1 On Sun, Mar 17, 2013 at 6:33 PM, Michał Górny <mgorny@g.o> wrote:
2 > The PYTHON_COMPAT_OVERRIDE can be set in the environment to enforce
3 > a different set of Python implementations than one being intersection
4 > of PYTHON_COMPAT and PYTHON_TARGETS.
5 >
6 > Due to technical limitations, the variable influences only the list
7 > of implementations actually used. USE flags, dependencies and other
8 > metadata variables are not modified.
9 > ---
10 > gx86/eclass/python-r1.eclass | 34 ++++++++++++++++++++++++++++++++++
11 > 1 file changed, 34 insertions(+)
12 >
13 > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
14 > index 99bd240..c060c24 100644
15 > --- a/gx86/eclass/python-r1.eclass
16 > +++ b/gx86/eclass/python-r1.eclass
17 > @@ -74,6 +74,25 @@ if ! declare -p PYTHON_COMPAT &>/dev/null; then
18 > fi
19 > fi
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 listing all
26 > +# the implementations which package will be built for. It need be
27 > +# specified 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 is ignored, and all the implementations
32 > +# in PYTHON_COMPAT_OVERRIDE are built. Dependencies need to be satisfied
33 > +# manually.
34 > +#
35 > +# Example:
36 > +# @CODE
37 > +# PYTHON_COMPAT_OVERRIDE='pypy2_0 python3_3' emerge -1v dev-python/foo
38 > +# @CODE
39 > +
40 > # @ECLASS-VARIABLE: PYTHON_REQ_USE
41 > # @DEFAULT_UNSET
42 > # @DESCRIPTION:
43 > @@ -576,6 +595,21 @@ _python_check_USE_PYTHON() {
44 > # @DESCRIPTION:
45 > # Set up the enabled implementation list.
46 > _python_obtain_impls() {
47 > + if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
48 > + if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
49 > + ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
50 > + ewarn "implementations will be enabled:"
51 > + ewarn
52 > + ewarn " ${PYTHON_COMPAT_OVERRIDE}"
53 > + ewarn
54 > + ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored."
55 > + _PYTHON_COMPAT_OVERRIDE_WARNED=1
56 > + fi
57 > +
58 > + MULTIBUILD_VARIANTS=( ${PYTHON_COMPAT_OVERRIDE} )
59 > + return
60 > + fi
61 > +
62 > _python_validate_useflags
63 > _python_check_USE_PYTHON
64 >
65 > --
66 > 1.8.1.5
67 >
68
69 This could be quite handy.