summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/python-r1.eclass17
-rw-r--r--eclass/python-single-r1.eclass117
-rw-r--r--eclass/python-utils-r1.eclass13
4 files changed, 116 insertions, 37 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 82bea19bc0f2..6ebce3fd473d 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for eclass directory
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.529 2012/11/29 17:56:39 hasufell Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.530 2012/11/30 11:40:15 mgorny Exp $
+
+ 30 Nov 2012; Michał Górny <mgorny@gentoo.org> python-r1.eclass,
+ python-single-r1.eclass, python-utils-r1.eclass:
+ Make python-single-r1 stand-alone, and blocking python-r1.
29 Nov 2012; Julian Ospald <hasufell@gentoo.org> waf-utils.eclass:
add verbosity to waf-utils.eclass wrt #444562
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index c98969081fbc..3e1a4d2240ed 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-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-r1.eclass,v 1.23 2012/11/26 08:31:26 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.24 2012/11/30 11:40:15 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -42,18 +42,11 @@ esac
if [[ ! ${_PYTHON_R1} ]]; then
-inherit python-utils-r1
+if [[ ${_PYTHON_SINGLE_R1} ]]; then
+ die 'python-r1.eclass can not be used with python-single-r1.eclass.'
+fi
-# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All supported Python implementations, most preferred last.
-_PYTHON_ALL_IMPLS=(
- jython2_5
- pypy1_8 pypy1_9
- python3_1 python3_2 python3_3
- python2_5 python2_6 python2_7
-)
+inherit python-utils-r1
# @ECLASS-VARIABLE: PYTHON_COMPAT
# @REQUIRED
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
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index d8e4b815cc8e..caf32c13b8bd 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-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-utils-r1.eclass,v 1.3 2012/11/26 10:16:43 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.4 2012/11/30 11:40:15 mgorny Exp $
# @ECLASS: python-utils-r1
# @MAINTAINER:
@@ -40,6 +40,17 @@ if [[ ! ${_PYTHON_UTILS_R1} ]]; then
inherit multilib
+# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All supported Python implementations, most preferred last.
+_PYTHON_ALL_IMPLS=(
+ jython2_5
+ pypy1_8 pypy1_9
+ python3_1 python3_2 python3_3
+ python2_5 python2_6 python2_7
+)
+
# @ECLASS-VARIABLE: PYTHON
# @DESCRIPTION:
# The absolute path to the current Python interpreter.