summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eclass/ChangeLog6
-rw-r--r--eclass/python-any-r1.eclass24
-rw-r--r--eclass/python-r1.eclass23
-rw-r--r--eclass/python-single-r1.eclass23
-rw-r--r--eclass/python-utils-r1.eclass37
5 files changed, 55 insertions, 58 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 3e4e1739d7e4..a595c6b11f49 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.571 2012/12/20 21:01:50 jlec Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.572 2012/12/20 23:35:17 mgorny Exp $
+
+ 20 Dec 2012; Michał Górny <mgorny@gentoo.org> python-any-r1.eclass,
+ python-r1.eclass, python-single-r1.eclass, python-utils-r1.eclass:
+ Commonize the code for obtaining the Python interpreter dependency string.
20 Dec 2012; Justin Lecher <jlec@gentoo.org> flag-o-matic.eclass:
Add fix for nen gnu compiler which use -x as command line arg internally,
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index ad56dc7520e2..734d3dbae799 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-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-any-r1.eclass,v 1.2 2012/12/07 18:00:08 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.3 2012/12/20 23:35:17 mgorny Exp $
# @ECLASS: python-any-r1
# @MAINTAINER:
@@ -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/eclass/python-r1.eclass b/eclass/python-r1.eclass
index aa9153e5b551..cc66f2cc9d39 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.30 2012/12/19 09:22:17 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.31 2012/12/20 23:35:17 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -149,30 +149,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/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass
index b2393995c42b..fa4a309dfe13 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.8 2012/12/17 20:09:28 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.9 2012/12/20 23:35:17 mgorny Exp $
# @ECLASS: python-single-r1
# @MAINTAINER:
@@ -144,35 +144,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
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 1e523b282269..afa478b19a9e 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.8 2012/12/20 06:05:23 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.9 2012/12/20 23:35:17 mgorny Exp $
# @ECLASS: python-utils-r1
# @MAINTAINER:
@@ -83,6 +83,17 @@ _PYTHON_ALL_IMPLS=(
# /usr/lib64/python2.6/site-packages
# @CODE
+# @ECLASS-VARIABLE: PYTHON_PKG_DEP
+# @DESCRIPTION:
+# The complete dependency on a particular Python package as a string.
+#
+# Set and exported on request using python_export().
+#
+# Example value:
+# @CODE
+# dev-lang/python:2.7[xml]
+# @CODE
+
# @FUNCTION: python_export
# @USAGE: [<impl>] <variables>...
# @DESCRIPTION:
@@ -150,6 +161,30 @@ python_export() {
export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
;;
+ PYTHON_PKG_DEP)
+ local d
+ case ${impl} in
+ python*)
+ PYTHON_PKG_DEP='dev-lang/python';;
+ jython*)
+ PYTHON_PKG_DEP='dev-java/jython';;
+ pypy*)
+ PYTHON_PKG_DEP='dev-python/pypy';;
+ *)
+ die "Invalid implementation: ${impl}"
+ esac
+
+ # slot
+ PYTHON_PKG_DEP+=:${impl##*[a-z-]}
+
+ # use-dep
+ if [[ ${PYTHON_REQ_USE} ]]; then
+ PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
+ fi
+
+ export PYTHON_PKG_DEP
+ debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
+ ;;
*)
die "python_export: unknown variable ${var}"
esac