summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2012-11-30 11:40:15 +0000
committerMichał Górny <mgorny@gentoo.org>2012-11-30 11:40:15 +0000
commit09ec412a7d9eb19b4570fdbf2d1f2c7fef7eee7a (patch)
treefb9ca11c24087f6a27a1705ff214f1347af4e78d /eclass/python-single-r1.eclass
parentStable for x86, wrt bug #445246 (diff)
downloadhistorical-09ec412a7d9eb19b4570fdbf2d1f2c7fef7eee7a.tar.gz
historical-09ec412a7d9eb19b4570fdbf2d1f2c7fef7eee7a.tar.bz2
historical-09ec412a7d9eb19b4570fdbf2d1f2c7fef7eee7a.zip
Make python-single-r1 stand-alone, and blocking python-r1.
Diffstat (limited to 'eclass/python-single-r1.eclass')
-rw-r--r--eclass/python-single-r1.eclass117
1 files changed, 94 insertions, 23 deletions
diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index 1fdf803b91c1..8e9b3778d358 100644
--- a/eclass/python-single-r1.eclass
+++ b/eclass/python-single-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.4 2012/11/26 10:05:11 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.5 2012/11/30 11:40:15 mgorny Exp $
# @ECLASS: python-single-r1
# @MAINTAINER:
@@ -23,9 +23,10 @@
# (using python-r1 eclass) can not depend on packages not supporting
# them (using this eclass).
#
-# Also, please note that python-single-r1 will always inherit python-r1
-# as well. Thus, all the variables defined there are relevant
-# to the packages using python-single-r1.
+# Please note that python-single-r1 will always inherit python-utils-r1
+# as well. Thus, all the functions defined there can be used
+# in the packages using python-single-r1, and there is no need ever
+# to inherit both.
#
# For more information, please see the python-r1 Developer's Guide:
# http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
@@ -44,7 +45,11 @@ esac
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
-inherit python-r1
+if [[ ${_PYTHON_R1} ]]; then
+ die 'python-single-r1.eclass can not be used with python-r1.eclass.'
+fi
+
+inherit python-utils-r1
fi
@@ -52,13 +57,89 @@ EXPORT_FUNCTIONS pkg_setup
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
+# @ECLASS-VARIABLE: PYTHON_COMPAT
+# @REQUIRED
+# @DESCRIPTION:
+# This variable contains a list of Python implementations the package
+# supports. It must be set before the `inherit' call. It has to be
+# an array.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
+# @CODE
+if ! declare -p PYTHON_COMPAT &>/dev/null; then
+ die 'PYTHON_COMPAT not declared.'
+fi
+
+# @ECLASS-VARIABLE: PYTHON_REQ_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The list of USEflags required to be enabled on the chosen Python
+# implementations, formed as a USE-dependency string. It should be valid
+# for all implementations in PYTHON_COMPAT, so it may be necessary to
+# use USE defaults.
+#
+# Example:
+# @CODE
+# PYTHON_REQ_USE="gdbm,ncurses(-)?"
+# @CODE
+#
+# It will cause the Python dependencies to look like:
+# @CODE
+# python_single_target_pythonX_Y? ( dev-lang/python:X.Y[gdbm,ncurses(-)?] )
+# @CODE
+
+# @ECLASS-VARIABLE: PYTHON_DEPS
+# @DESCRIPTION:
+# This is an eclass-generated Python dependency string for all
+# implementations listed in PYTHON_COMPAT.
+#
+# The dependency string is conditional on PYTHON_SINGLE_TARGET.
+#
+# Example use:
+# @CODE
+# RDEPEND="${PYTHON_DEPS}
+# dev-foo/mydep"
+# DEPEND="${RDEPEND}"
+# @CODE
+#
+# Example value:
+# @CODE
+# dev-python/python-exec
+# python_single_target_python2_6? ( dev-lang/python:2.6[gdbm] )
+# python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
+# @CODE
+
+# @ECLASS-VARIABLE: PYTHON_USEDEP
+# @DESCRIPTION:
+# This is an eclass-generated USE-dependency string which can be used to
+# depend on another Python package being built for the same Python
+# implementations.
+#
+# The generate USE-flag list is compatible with packages using python-r1,
+# python-single-r1 and python-distutils-ng eclasses. It must not be used
+# on packages using python.eclass.
+#
+# Example use:
+# @CODE
+# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
+# @CODE
+#
+# Example value:
+# @CODE
+# python_targets_python2_7?,python_single_target_python2_7(+)?
+# @CODE
+
_python_single_set_globals() {
+ local flags_mt=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
local flags=( "${PYTHON_COMPAT[@]/#/python_single_target_}" )
- local optflags=${flags[@]/%/(+)?}
+ local optflags=${flags_mt[@]/%/?}
+ optflags+=,${flags[@]/%/(+)?}
- IUSE=${flags[*]}
- REQUIRED_USE="^^ ( ${flags[*]} )"
- PYTHON_USEDEP+=,${optflags// /,}
+ IUSE="${flags_mt[*]} ${flags[*]}"
+ REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
+ PYTHON_USEDEP=${optflags// /,}
local usestr
[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
@@ -88,6 +169,10 @@ _python_single_set_globals() {
}
_python_single_set_globals
+# @FUNCTION: python-single-r1_pkg_setup
+# @DESCRIPTION:
+# Determine what the selected Python implementation is and set EPYTHON
+# and PYTHON accordingly.
python-single-r1_pkg_setup() {
debug-print-function ${FUNCNAME} "${@}"
@@ -102,19 +187,5 @@ python-single-r1_pkg_setup() {
done
}
-# Incompatible python-r1 functions.
-
-python_copy_sources() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
-python_foreach_impl() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
-python_export_best() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
_PYTHON_SINGLE_R1=1
fi