public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT.
@ 2012-12-13 10:44 Michał Górny
  2012-12-13 15:30 ` [gentoo-python] " Mike Gilbert
  2013-03-13  9:20 ` [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT Nikolaj Sjujskij
  0 siblings, 2 replies; 11+ messages in thread
From: Michał Górny @ 2012-12-13 10:44 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

PYTHON_COMPAT_OVERRIDE is an environment variable which overrides
the current value of PYTHON_COMPAT.

Useful for testing packages with new Python implementations quickly
without modifying the ebuild. Outputs a lot of noisy warnings to make
sure people notice how hacky it is.

Example use:

$ PYTHON_COMPAT_OVERRIDE=python3_3 emerge -1v dev-python/nose
---
 gx86/eclass/python-any-r1.eclass    | 5 ++++-
 gx86/eclass/python-r1.eclass        | 5 ++++-
 gx86/eclass/python-single-r1.eclass | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
index ad56dc7..cd23aa4 100644
--- a/gx86/eclass/python-any-r1.eclass
+++ b/gx86/eclass/python-any-r1.eclass
@@ -65,7 +65,10 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then
 # @CODE
 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
 # @CODE
-if ! declare -p PYTHON_COMPAT &>/dev/null; then
+if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
+	ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
+	PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
+elif ! declare -p PYTHON_COMPAT &>/dev/null; then
 	die 'PYTHON_COMPAT not declared.'
 fi
 
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 39de7f2..63bfb4e 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -66,7 +66,10 @@ inherit python-utils-r1
 # @CODE
 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
 # @CODE
-if ! declare -p PYTHON_COMPAT &>/dev/null; then
+if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
+	ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
+	PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
+elif ! declare -p PYTHON_COMPAT &>/dev/null; then
 	if [[ ${CATEGORY}/${PN} == dev-python/python-exec ]]; then
 		PYTHON_COMPAT=( "${_PYTHON_ALL_IMPLS[@]}" )
 	else
diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
index 51807f2..73f05f6 100644
--- a/gx86/eclass/python-single-r1.eclass
+++ b/gx86/eclass/python-single-r1.eclass
@@ -70,7 +70,10 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
 # @CODE
 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
 # @CODE
-if ! declare -p PYTHON_COMPAT &>/dev/null; then
+if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
+	ewarn "PYTHON_COMPAT overriden: ${PYTHON_COMPAT_OVERRIDE}"
+	PYTHON_COMPAT=( ${PYTHON_COMPAT_OVERRIDE} )
+elif ! declare -p PYTHON_COMPAT &>/dev/null; then
 	die 'PYTHON_COMPAT not declared.'
 fi
 
-- 
1.8.0.2



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-03-15  5:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-13 10:44 [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT Michał Górny
2012-12-13 15:30 ` [gentoo-python] " Mike Gilbert
2012-12-13 15:51   ` Michał Górny
2012-12-13 17:50   ` [gentoo-python] [PATCH] Add docs Michał Górny
2013-03-13  9:20 ` [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT Nikolaj Sjujskij
2013-03-13 19:49   ` Michał Górny
2013-03-14 13:10     ` Nikolaj Sjujskij
2013-03-14 16:15       ` Michał Górny
2013-03-14 16:41         ` Nikolaj Sjujskij
2013-03-14 19:02         ` Mike Gilbert
2013-03-15  5:29           ` Nikolaj Sjujskij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox