summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-03-04 19:27:58 +0000
committerMichał Górny <mgorny@gentoo.org>2013-03-04 19:27:58 +0000
commit3e9b51d00a009c7e3e5b55bbc71efcd97f65ed70 (patch)
treedb9397939f0aece44c94e40939eafe0ad4ea2acf /eclass
parentAdd multibuild_for_best_variant. (diff)
downloadhistorical-3e9b51d00a009c7e3e5b55bbc71efcd97f65ed70.tar.gz
historical-3e9b51d00a009c7e3e5b55bbc71efcd97f65ed70.tar.bz2
historical-3e9b51d00a009c7e3e5b55bbc71efcd97f65ed70.zip
Use multibuild.eclass in python-r1.
Diffstat (limited to 'eclass')
-rw-r--r--eclass/ChangeLog5
-rw-r--r--eclass/python-r1.eclass59
2 files changed, 39 insertions, 25 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog
index 75be444a2b3b..123c8febbe5f 100644
--- a/eclass/ChangeLog
+++ b/eclass/ChangeLog
@@ -1,6 +1,9 @@
# ChangeLog for eclass directory
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.708 2013/03/04 19:27:24 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.709 2013/03/04 19:27:58 mgorny Exp $
+
+ 04 Mar 2013; Michał Górny <mgorny@gentoo.org> python-r1.eclass:
+ Use multibuild.eclass in python-r1.
04 Mar 2013; Michał Górny <mgorny@gentoo.org> multibuild.eclass:
Add multibuild_for_best_variant.
diff --git a/eclass/python-r1.eclass b/eclass/python-r1.eclass
index 9d094b99977e..5bcb8cca3fa9 100644
--- a/eclass/python-r1.eclass
+++ b/eclass/python-r1.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.45 2013/03/04 19:22:13 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.46 2013/03/04 19:27:58 mgorny Exp $
# @ECLASS: python-r1
# @MAINTAINER:
@@ -578,6 +578,37 @@ _python_check_USE_PYTHON() {
fi
}
+# @FUNCTION: _python_obtain_impls
+# @INTERNAL
+# @DESCRIPTION:
+# Set up the enabled implementation list.
+_python_obtain_impls() {
+ MULTIBUILD_VARIANTS=()
+
+ for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
+ if has "${impl}" "${PYTHON_COMPAT[@]}" \
+ && use "python_targets_${impl}"
+ then
+ MULTIBUILD_VARIANTS+=( "${impl}" )
+ fi
+ done
+}
+
+# @FUNCTION: _python_multibuild_wrapper
+# @USAGE: <command> [<args>...]
+# @INTERNAL
+# @DESCRIPTION:
+# Initialize the environment for Python implementation selected
+# for multibuild.
+_python_multibuild_wrapper() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local -x EPYTHON PYTHON
+ python_export "${MULTIBUILD_VARIANT}" EPYTHON PYTHON
+
+ "${@}"
+}
+
# @FUNCTION: python_foreach_impl
# @USAGE: <command> [<args>...]
# @DESCRIPTION:
@@ -597,30 +628,10 @@ python_foreach_impl() {
_python_validate_useflags
_python_check_USE_PYTHON
- local impl
- local bdir=${BUILD_DIR:-${S}}
- local ret=0 lret=0
-
- debug-print "${FUNCNAME}: bdir = ${bdir}"
- for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
- if has "${impl}" "${PYTHON_COMPAT[@]}" \
- && _python_impl_supported "${impl}" \
- && use "python_targets_${impl}"
- then
- local EPYTHON PYTHON
- python_export "${impl}" EPYTHON PYTHON
- local BUILD_DIR=${bdir%%/}-${impl}
- export EPYTHON PYTHON
-
- einfo "${EPYTHON}: running ${@}"
- "${@}"
- lret=${?}
-
- [[ ${ret} -eq 0 && ${lret} -ne 0 ]] && ret=${lret}
- fi
- done
+ local MULTIBUILD_VARIANTS
+ _python_obtain_impls
- return ${ret}
+ multibuild_foreach_variant _python_multibuild_wrapper "${@}"
}
# @FUNCTION: python_export_best