summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-01-21 19:28:16 +0000
committerMichał Górny <mgorny@gentoo.org>2013-01-21 19:28:16 +0000
commit52f73ea7141b46bb1e40ca00e0471b10d0b5097b (patch)
tree8064d24e046548f63820318c03114ba556639859 /eclass/python-utils-r1.eclass
parentold (diff)
downloadhistorical-52f73ea7141b46bb1e40ca00e0471b10d0b5097b.tar.gz
historical-52f73ea7141b46bb1e40ca00e0471b10d0b5097b.tar.bz2
historical-52f73ea7141b46bb1e40ca00e0471b10d0b5097b.zip
Check PYTHON_COMPAT for validity, and support disabling implementations in the eclass.
Diffstat (limited to 'eclass/python-utils-r1.eclass')
-rw-r--r--eclass/python-utils-r1.eclass33
1 files changed, 32 insertions, 1 deletions
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index ba270b52d774..474ac08a9d21 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-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-utils-r1.eclass,v 1.13 2013/01/05 10:01:20 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.14 2013/01/21 19:28:16 mgorny Exp $
# @ECLASS: python-utils-r1
# @MAINTAINER:
@@ -47,6 +47,37 @@ _PYTHON_ALL_IMPLS=(
python2_5 python2_6 python2_7
)
+# @FUNCTION: _python_impl_supported
+# @USAGE: <impl>
+# @INTERNAL
+# @DESCRIPTION:
+# Check whether the implementation <impl> (PYTHON_COMPAT-form)
+# is still supported.
+#
+# Returns 0 if the implementation is valid and supported. If it is
+# unsupported, returns 1 -- and the caller should ignore the entry.
+# If it is invalid, dies with an appopriate error messages.
+_python_impl_supported() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl)."
+
+ local impl=${1}
+
+ # keep in sync with _PYTHON_ALL_IMPLS!
+ # (not using that list because inline patterns shall be faster)
+ case "${impl}" in
+ python2_[567]|python3_[123]|pypy1_[89]|pypy2_0|jython2_5)
+ return 0
+ ;;
+# pypy1_8)
+# return 1
+# ;;
+ *)
+ die "Invalid implementation in PYTHON_COMPAT: ${impl}"
+ esac
+}
+
# @ECLASS-VARIABLE: PYTHON
# @DESCRIPTION:
# The absolute path to the current Python interpreter.