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] Support overriding PYTHON_COMPAT.
Date: Thu, 13 Dec 2012 10:44:44
Message-Id: 1355395481-17517-1-git-send-email-mgorny@gentoo.org
1 PYTHON_COMPAT_OVERRIDE is an environment variable which overrides
2 the current value of PYTHON_COMPAT.
3
4 Useful for testing packages with new Python implementations quickly
5 without modifying the ebuild. Outputs a lot of noisy warnings to make
6 sure people notice how hacky it is.
7
8 Example use:
9
10 $ PYTHON_COMPAT_OVERRIDE=python3_3 emerge -1v dev-python/nose
11 ---
12 gx86/eclass/python-any-r1.eclass | 5 ++++-
13 gx86/eclass/python-r1.eclass | 5 ++++-
14 gx86/eclass/python-single-r1.eclass | 5 ++++-
15 3 files changed, 12 insertions(+), 3 deletions(-)
16
17 diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
18 index ad56dc7..cd23aa4 100644
19 --- a/gx86/eclass/python-any-r1.eclass
20 +++ b/gx86/eclass/python-any-r1.eclass
21 @@ -65,7 +65,10 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then
22 # @CODE
23 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
24 # @CODE
25 -if ! declare -p PYTHON_COMPAT &>/dev/null; then
26 +if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
27 + ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
28 + PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
29 +elif ! declare -p PYTHON_COMPAT &>/dev/null; then
30 die 'PYTHON_COMPAT not declared.'
31 fi
32
33 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
34 index 39de7f2..63bfb4e 100644
35 --- a/gx86/eclass/python-r1.eclass
36 +++ b/gx86/eclass/python-r1.eclass
37 @@ -66,7 +66,10 @@ inherit python-utils-r1
38 # @CODE
39 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
40 # @CODE
41 -if ! declare -p PYTHON_COMPAT &>/dev/null; then
42 +if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
43 + ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
44 + PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
45 +elif ! declare -p PYTHON_COMPAT &>/dev/null; then
46 if [[ ${CATEGORY}/${PN} == dev-python/python-exec ]]; then
47 PYTHON_COMPAT=( "${_PYTHON_ALL_IMPLS[@]}" )
48 else
49 diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
50 index 51807f2..73f05f6 100644
51 --- a/gx86/eclass/python-single-r1.eclass
52 +++ b/gx86/eclass/python-single-r1.eclass
53 @@ -70,7 +70,10 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
54 # @CODE
55 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
56 # @CODE
57 -if ! declare -p PYTHON_COMPAT &>/dev/null; then
58 +if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
59 + ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
60 + PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
61 +elif ! declare -p PYTHON_COMPAT &>/dev/null; then
62 die 'PYTHON_COMPAT not declared.'
63 fi
64
65 --
66 1.8.0.2

Replies

Subject Author
[gentoo-python] Re: [PATCH] Support overriding PYTHON_COMPAT. Mike Gilbert <floppym@g.o>
Re: [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT. Nikolaj Sjujskij <sterkrig@×××××××.com>