public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-python@lists.gentoo.org
Cc: python@gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-python] [PATCH] Generate python depstrings in python-r1.
Date: Fri, 14 Sep 2012 22:32:57 +0200	[thread overview]
Message-ID: <1347654777-7026-1-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1347613840-8247-1-git-send-email-mgorny@gentoo.org>

---
 gx86/eclass/python-distutils-ng.eclass | 20 ++------------------
 gx86/eclass/python-r1.eclass           | 28 ++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 63abdac..71f8030 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -82,24 +82,8 @@ _python-distutils-ng_get_binary_for_implementation() {
 	esac
 }
 
-for impl in ${PYTHON_COMPAT[@]}; do
-	dep_str="${impl/_/.}"
-	case "${dep_str}" in
-		python?.?)
-			dep_str="dev-lang/python:${dep_str: -3}" ;;
-		jython?.?)
-			dep_str="dev-java/jython:${dep_str: -3}" ;;
-		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}" ;;
-		*)
-			die "Unsupported implementation: ${impl}" ;;
-	esac
-	dep_str="python_targets_${impl}? ( ${dep_str} )"
-
-	RDEPEND="${RDEPEND} ${dep_str}"
-	DEPEND="${DEPEND} ${dep_str}"
-	unset dep_str
-done
+RDEPEND=${PYTHON_DEPEND}
+DEPEND=${PYTHON_DEPEND}
 
 _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
 
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 18f9246..3017dd8 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -40,14 +40,38 @@ _PYTHON_ALL_IMPLS=(
 # a package supports. It must be set before the `inherit' call.
 # The default is to enable all implementations.
 #
-# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
-# will implicitly convert it to an array.
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
+# the eclass will implicitly convert it to an array.
 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
 
+# @ECLASS-VARIABLE: PYTHON_DEPEND
+# @DESCRIPTION:
+# This is an eclass-generated Python dependency string for all
+# implementations listed in PYTHON_COMPAT.
+
 PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
 
 _python_set_globals() {
 	IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
 	REQUIRED_USE="|| ( ${IUSE} )"
+
+	PYTHON_DEPEND=
+	local i
+	for i in ${PYTHON_COMPAT[@]}; do
+		local d
+		case ${i} in
+			python*)
+				d='dev-lang/python';;
+			jython*)
+				d='dev-java/jython';;
+			pypy*)
+				d='dev-python/pypy';;
+			*)
+				die "Invalid implementation: ${i}"
+		esac
+
+		local v=${i##*[a-z]}
+		PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )"
+	done
 }
 _python_set_globals
-- 
1.7.12



      parent reply	other threads:[~2012-09-14 20:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14  9:10 [gentoo-python] First steps in python-r1.eclass Michał Górny
2012-09-14  9:10 ` [gentoo-python] [PATCH 1/2] Support PYTHON_COMPAT being an array Michał Górny
2012-09-14  9:10 ` [gentoo-python] [PATCH 2/2] Move PYTHON_COMPAT, IUSE and REQUIRED_USE to python-r1 Michał Górny
2012-09-14  9:13   ` Michał Górny
2012-09-14 20:32 ` Michał Górny [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347654777-7026-1-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-python@lists.gentoo.org \
    --cc=python@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox