public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH] Support overriding PYTHON_COMPAT.
Date: Thu, 13 Dec 2012 11:44:41 +0100	[thread overview]
Message-ID: <1355395481-17517-1-git-send-email-mgorny@gentoo.org> (raw)

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



             reply	other threads:[~2012-12-13 10:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13 10:44 Michał Górny [this message]
2012-12-13 15:30 ` [gentoo-python] Re: [PATCH] Support overriding PYTHON_COMPAT 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1355395481-17517-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox