summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-03-20 19:01:54 +0000
committerMichał Górny <mgorny@gentoo.org>2013-03-20 19:01:54 +0000
commit891c03db305b00c2ba65e28d4c64e537c729ed26 (patch)
treeccb17ef614fcbf25f14fe5c0f76ded6a0d1043dd /eclass
parentReuse multibuild.eclass in python_export_best. (diff)
downloadgentoo-2-891c03db305b00c2ba65e28d4c64e537c729ed26.tar.gz
gentoo-2-891c03db305b00c2ba65e28d4c64e537c729ed26.tar.bz2
gentoo-2-891c03db305b00c2ba65e28d4c64e537c729ed26.zip
Introduce an ability to override PYTHON_COMPAT for testing.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/python-r1.eclass36
2 files changed, 39 insertions, 2 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 75c7f9039589..a1fe56f4b973 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.747 2013/03/20 19:00:54 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.748 2013/03/20 19:01:54 mgorny Exp $
+
+ 20 Mar 2013; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+ Introduce an ability to override PYTHON_COMPAT for testing.
20 Mar 2013; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
Reuse multibuild.eclass in python_export_best.
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index b743473522e4..4ba80a9de718 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.50 2013/03/20 19:00:55 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.51 2013/03/20 19:01:54 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -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