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 python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier.
Date: Sun, 17 Mar 2013 23:33:50 +0100	[thread overview]
Message-ID: <1363559630-17431-2-git-send-email-mgorny@gentoo.org> (raw)

The PYTHON_COMPAT_OVERRIDE can be set in the environment to enforce
a different set of Python implementations than one being intersection
of PYTHON_COMPAT and PYTHON_TARGETS.

Due to technical limitations, the variable influences only the list
of implementations actually used. USE flags, dependencies and other
metadata variables are not modified.
---
 gx86/eclass/python-r1.eclass | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 99bd240..c060c24 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -74,6 +74,25 @@ if ! declare -p PYTHON_COMPAT &>/dev/null; then
 	fi
 fi
 
+# @ECLASS-VARIABLE: PYTHON_COMPAT_OVERRIDE
+# @INTERNAL
+# @DESCRIPTION:
+# This variable can be used when working with ebuilds to override
+# the in-ebuild PYTHON_COMPAT. It is a string listing all
+# the implementations which package will be built for. It need be
+# specified in the calling environment, and not in ebuilds.
+#
+# It should be noted that in order to preserve metadata immutability,
+# PYTHON_COMPAT_OVERRIDE does not affect IUSE nor dependencies.
+# The state of PYTHON_TARGETS is ignored, and all the implementations
+# in PYTHON_COMPAT_OVERRIDE are built. Dependencies need to be satisfied
+# manually.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT_OVERRIDE='pypy2_0 python3_3' emerge -1v dev-python/foo
+# @CODE
+
 # @ECLASS-VARIABLE: PYTHON_REQ_USE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -576,6 +595,21 @@ _python_check_USE_PYTHON() {
 # @DESCRIPTION:
 # Set up the enabled implementation list.
 _python_obtain_impls() {
+	if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
+		if [[ ! ${_PYTHON_COMPAT_OVERRIDE_WARNED} ]]; then
+			ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
+			ewarn "implementations will be enabled:"
+			ewarn
+			ewarn "	${PYTHON_COMPAT_OVERRIDE}"
+			ewarn
+			ewarn "Dependencies won't be satisfied, and PYTHON_TARGETS will be ignored."
+			_PYTHON_COMPAT_OVERRIDE_WARNED=1
+		fi
+
+		MULTIBUILD_VARIANTS=( ${PYTHON_COMPAT_OVERRIDE} )
+		return
+	fi
+
 	_python_validate_useflags
 	_python_check_USE_PYTHON
 
-- 
1.8.1.5



             reply	other threads:[~2013-03-17 22:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-17 22:33 Michał Górny [this message]
2013-03-17 23:37 ` [gentoo-python] Re: [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier Mike Gilbert
2013-03-20 11:10 ` [gentoo-python] " Nikolaj Sjujskij
2013-03-20 19:03   ` Michał Górny
2013-03-21  6:59     ` Nikolaj Sjujskij
2013-03-21 10:27       ` Michał Górny
2013-03-21 11:30         ` Nikolaj Sjujskij
2013-03-21 11:55           ` Michał Górny
2013-03-21 12:12             ` 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=1363559630-17431-2-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