From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 4A3F01381FA for ; Mon, 31 Dec 2012 13:10:53 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4401221C029; Mon, 31 Dec 2012 13:10:45 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id AF84C21C029 for ; Mon, 31 Dec 2012 13:10:44 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9621633D884 for ; Mon, 31 Dec 2012 13:10:43 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2279) id 5B2312171D; Mon, 31 Dec 2012 13:10:42 +0000 (UTC) From: "Michal Gorny (mgorny)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, mgorny@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog python-r1.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: ChangeLog python-r1.eclass X-VCS-Directories: eclass X-VCS-Committer: mgorny X-VCS-Committer-Name: Michal Gorny Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Message-Id: <20121231131042.5B2312171D@flycatcher.gentoo.org> Date: Mon, 31 Dec 2012 13:10:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e0ca3c06-2534-4514-985d-01c39a44d911 X-Archives-Hash: 2ab613f27ccde2cc0a95566c5e00c3d3 mgorny 12/12/31 13:10:42 Modified: ChangeLog python-r1.eclass Log: Add a function to generate dep-strings conditional to Python implementations. Revision Changes Path 1.586 eclass/ChangeLog file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.586&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.586&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.585&r2=1.586 Index: ChangeLog =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v retrieving revision 1.585 retrieving revision 1.586 diff -u -r1.585 -r1.586 --- ChangeLog 31 Dec 2012 13:09:09 -0000 1.585 +++ ChangeLog 31 Dec 2012 13:10:42 -0000 1.586 @@ -1,6 +1,9 @@ # ChangeLog for eclass directory # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.585 2012/12/31 13:09:09 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.586 2012/12/31 13:10:42 mgorny Exp $ + + 31 Dec 2012; Michał Górny python-r1.eclass: + Add a function to generate dep-strings conditional to Python implementations. 31 Dec 2012; Michał Górny systemd.eclass: Add function to get user unit directory, as requested in bug #449304. 1.33 eclass/python-r1.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.33&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.33&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.32&r2=1.33 Index: python-r1.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- python-r1.eclass 27 Dec 2012 22:56:21 -0000 1.32 +++ python-r1.eclass 31 Dec 2012 13:10:42 -0000 1.33 @@ -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.32 2012/12/27 22:56:21 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.33 2012/12/31 13:10:42 mgorny Exp $ # @ECLASS: python-r1 # @MAINTAINER: @@ -163,7 +163,7 @@ _python_set_globals # @FUNCTION: python_gen_usedep -# @USAGE: pattern [...] +# @USAGE: [...] # @DESCRIPTION: # Output a USE dependency string for Python implementations which # are both in PYTHON_COMPAT and match any of the patterns passed @@ -206,7 +206,7 @@ } # @FUNCTION: python_gen_useflags -# @USAGE: pattern [...] +# @USAGE: [...] # @DESCRIPTION: # Output a list of USE flags for Python implementations which # are both in PYTHON_COMPAT and match any of the patterns passed @@ -240,6 +240,49 @@ echo ${matches[@]} } +# @FUNCTION: python_gen_cond_dep +# @USAGE: [...] +# @DESCRIPTION: +# Output a list of -ies made conditional to USE flags +# 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. +# +# Example: +# @CODE +# PYTHON_COMPAT=( python{2_5,2_6,2_7} ) +# RDEPEND="$(python_gen_cond_dep dev-python/unittest2 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 )" +# @CODE +python_gen_cond_dep() { + debug-print-function ${FUNCNAME} "${@}" + + local impl pattern + local matches=() + + local dep=${1} + shift + + for impl in "${PYTHON_COMPAT[@]}"; do + for pattern; do + if [[ ${impl} == ${pattern} ]]; then + matches+=( "python_targets_${impl}? ( ${dep} )" ) + break + fi + done + done + + echo ${matches[@]} +} + # @ECLASS-VARIABLE: BUILD_DIR # @DESCRIPTION: # The current build directory. In global scope, it is supposed to