summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-04-19 10:29:06 +0000
committerMichał Górny <mgorny@gentoo.org>2014-04-19 10:29:06 +0000
commit5717908ca04cab2effb87b82f0111a1eac202a8a (patch)
tree62d1c8c7ef624339610c616b78246075eb66bcf0 /eclass/python-r1.eclass
parentMove to testing for sparc (#508064) (diff)
downloadhistorical-5717908ca04cab2effb87b82f0111a1eac202a8a.tar.gz
historical-5717908ca04cab2effb87b82f0111a1eac202a8a.tar.bz2
historical-5717908ca04cab2effb87b82f0111a1eac202a8a.zip
Support substituting ${PYTHON_USEDEP} in python_gen_cond_dep().
Diffstat (limited to 'eclass/python-r1.eclass')
-rw-r--r--eclass/python-r1.eclass24
1 files changed, 17 insertions, 7 deletions
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 898eab038194..0fb188d0d6bb 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.71 2014/04/09 21:34:10 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.72 2014/04/19 10:29:06 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -340,20 +340,24 @@ python_gen_useflags() {
# of Python implementations which are both in PYTHON_COMPAT and match
# any of the patterns passed as the remaining parameters.
#
-# Please note that USE constraints on the package need to be enforced
-# separately. Therefore, the dependency usually needs to use
-# python_gen_usedep as well.
+# In order to enforce USE constraints on the packages, verbatim
+# '${PYTHON_USEDEP}' (quoted!) may be placed in the dependency
+# specification. It will get expanded within the function into a proper
+# USE dependency string.
#
# Example:
# @CODE
# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
-# RDEPEND="$(python_gen_cond_dep dev-python/unittest2 python{2_5,2_6})"
+# RDEPEND="$(python_gen_cond_dep \
+# 'dev-python/unittest2[${PYTHON_USEDEP}]' python{2_5,2_6})"
# @CODE
#
# It will cause the variable to look like:
# @CODE
-# RDEPEND="python_targets_python2_5? ( dev-python/unittest2 )
-# python_targets_python2_6? ( dev-python/unittest2 )"
+# RDEPEND="python_targets_python2_5? (
+# dev-python/unittest2[python_targets_python2_5?] )
+# python_targets_python2_6? (
+# dev-python/unittest2[python_targets_python2_6?] )"
# @CODE
python_gen_cond_dep() {
debug-print-function ${FUNCNAME} "${@}"
@@ -364,6 +368,12 @@ python_gen_cond_dep() {
local dep=${1}
shift
+ # substitute ${PYTHON_USEDEP} if used
+ if [[ ${dep} == *'${PYTHON_USEDEP}'* ]]; then
+ local PYTHON_USEDEP=$(python_gen_usedep "${@}")
+ dep=${dep//\$\{PYTHON_USEDEP\}/${PYTHON_USEDEP}}
+ fi
+
for impl in "${PYTHON_COMPAT[@]}"; do
_python_impl_supported "${impl}" || continue