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 python-utils-r1 2/2] Use PYTHON_PKG_DEP to simplify eclasses.
Date: Mon, 17 Dec 2012 01:13:59 +0100	[thread overview]
Message-ID: <1355703239-21299-2-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <1355703239-21299-1-git-send-email-mgorny@gentoo.org>

---
 gx86/eclass/python-any-r1.eclass    | 22 +++++-----------------
 gx86/eclass/python-r1.eclass        | 21 +++------------------
 gx86/eclass/python-single-r1.eclass | 21 +++------------------
 3 files changed, 11 insertions(+), 53 deletions(-)

diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
index ad56dc7..4987025 100644
--- a/gx86/eclass/python-any-r1.eclass
+++ b/gx86/eclass/python-any-r1.eclass
@@ -202,25 +202,13 @@ python-any-r1_pkg_setup() {
 		fi
 	done
 
+	local PYTHON_PKG_DEP
 	for i in "${rev_impls[@]}"; 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]}
-
-		if has_version "${d}:${v/_/.}${usestr}"; then
-			python_export "${i}" EPYTHON PYTHON
-			break
-		fi
+		python_export "${i}" PYTHON_PKG_DEP EPYTHON PYTHON
+		has_version "${PYTHON_PKG_DEP}" && break
 	done
+
+	die $EPYTHON
 }
 
 _PYTHON_ANY_R1=1
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index cfd0a36..100de38 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -144,30 +144,15 @@ _python_set_globals() {
 	REQUIRED_USE="|| ( ${flags[*]} )"
 	PYTHON_USEDEP=${optflags// /,}
 
-	local usestr
-	[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
-
 	# 1) well, python-exec would suffice as an RDEP
 	# but no point in making this overcomplex, BDEP doesn't hurt anyone
 	# 2) python-exec should be built with all targets forced anyway
 	# but if new targets were added, we may need to force a rebuild
 	PYTHON_DEPS="dev-python/python-exec[${PYTHON_USEDEP}]"
-	local i
+	local i PYTHON_PKG_DEP
 	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_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.}${usestr} )"
+		python_export "${i}" PYTHON_PKG_DEP
+		PYTHON_DEPS+=" python_targets_${i}? ( ${PYTHON_PKG_DEP} )"
 	done
 }
 _python_set_globals
diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
index 51807f2..39f9320 100644
--- a/gx86/eclass/python-single-r1.eclass
+++ b/gx86/eclass/python-single-r1.eclass
@@ -143,35 +143,20 @@ _python_single_set_globals() {
 	REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
 	PYTHON_USEDEP=${optflags// /,}
 
-	local usestr
-	[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
-
 	# 1) well, python-exec would suffice as an RDEP
 	# but no point in making this overcomplex, BDEP doesn't hurt anyone
 	# 2) python-exec should be built with all targets forced anyway
 	# but if new targets were added, we may need to force a rebuild
 	PYTHON_DEPS="dev-python/python-exec[${PYTHON_USEDEP}]"
-	local i
+	local i PYTHON_PKG_DEP
 	for i in "${PYTHON_COMPAT[@]}"; do
 		# The chosen targets need to be in PYTHON_TARGETS as well.
 		# This is in order to enforce correct dependencies on packages
 		# supporting multiple implementations.
 		REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )"
 
-		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_DEPS+=" python_single_target_${i}? ( ${d}:${v/_/.}${usestr} )"
+		python_export "${i}" PYTHON_PKG_DEP
+		PYTHON_DEPS+=" python_single_target_${i}? ( ${PYTHON_PKG_DEP} )"
 	done
 }
 _python_single_set_globals
-- 
1.8.0.2



      reply	other threads:[~2012-12-17  0:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-17  0:13 [gentoo-python] [PATCH python-utils-r1 1/2] Introduce 'PYTHON_PKG_DEP' for dependency on Python Michał Górny
2012-12-17  0:13 ` 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=1355703239-21299-2-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