summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2015-12-12 23:20:26 +0100
committerMichał Górny <mgorny@gentoo.org>2015-12-22 23:12:23 +0100
commit8b2a03095469242427067911fd4bc467173753c1 (patch)
treee63d8691f78e414e305d00fb674ef33222b56496 /eclass/python-any-r1.eclass
parentpython-single-r1.eclass: Fix python_gen_* w/ single PYTHON_COMPAT impl (diff)
downloadgentoo-8b2a03095469242427067911fd4bc467173753c1.tar.gz
gentoo-8b2a03095469242427067911fd4bc467173753c1.tar.bz2
gentoo-8b2a03095469242427067911fd4bc467173753c1.zip
python-any-r1.eclass: Support PYTHON_COMPAT_OVERRIDE
Diffstat (limited to 'eclass/python-any-r1.eclass')
-rw-r--r--eclass/python-any-r1.eclass35
1 files changed, 35 insertions, 0 deletions
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index dbfededa10fc..99aac739b302 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -72,6 +72,24 @@ if [[ ! ${_PYTHON_ANY_R1} ]]; then
# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
# @CODE
+# @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 naming the implementation
+# which will be used to build the package. It needs to 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 dependencies. The value of
+# EPYTHON and eselect-python preferences are ignored. Dependencies need
+# to be satisfied manually.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT_OVERRIDE='pypy' emerge -1v dev-python/bar
+# @CODE
+
# @ECLASS-VARIABLE: PYTHON_REQ_USE
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -253,6 +271,23 @@ _python_EPYTHON_supported() {
python_setup() {
debug-print-function ${FUNCNAME} "${@}"
+ # support developer override
+ if [[ ${PYTHON_COMPAT_OVERRIDE} ]]; then
+ local impls=( ${PYTHON_COMPAT_OVERRIDE} )
+ [[ ${#impls[@]} -eq 1 ]] || die "PYTHON_COMPAT_OVERRIDE must name exactly one implementation for python-any-r1"
+
+ ewarn "WARNING: PYTHON_COMPAT_OVERRIDE in effect. The following Python"
+ ewarn "implementation will be used:"
+ ewarn
+ ewarn " ${PYTHON_COMPAT_OVERRIDE}"
+ ewarn
+ ewarn "Dependencies won't be satisfied, and EPYTHON/eselect-python will be ignored."
+
+ python_export "${impls[0]}" EPYTHON PYTHON
+ python_wrapper_setup
+ return
+ fi
+
# first, try ${EPYTHON}... maybe it's good enough for us.
if [[ ${EPYTHON} ]]; then
if _python_EPYTHON_supported "${EPYTHON}"; then