public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier.
@ 2013-03-17 22:33 Michał Górny
  2013-03-17 23:37 ` [gentoo-python] " Mike Gilbert
  2013-03-20 11:10 ` [gentoo-python] " Nikolaj Sjujskij
  0 siblings, 2 replies; 9+ messages in thread
From: Michał Górny @ 2013-03-17 22:33 UTC (permalink / raw
  To: gentoo-python; +Cc: python, Michał Górny

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



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

end of thread, other threads:[~2013-03-21 12:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-17 22:33 [gentoo-python] [PATCH python-r1 2/2] Introduce PYTHON_COMPAT_OVERRIDE to make testing easier Michał Górny
2013-03-17 23:37 ` [gentoo-python] " 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

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