public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: hasufell@gentoo.org, python@gentoo.org,
	"Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 2/7] distutils-r1: use multibuild phase helpers.
Date: Sun, 10 Mar 2013 11:18:06 +0100	[thread overview]
Message-ID: <1362910691-8439-2-git-send-email-mgorny@gentoo.org> (raw)
In-Reply-To: <20130310111644.0840d935@pomiocik.lan>

---
 gx86/eclass/distutils-r1.eclass | 71 ++++++++++++++++-------------------------
 1 file changed, 27 insertions(+), 44 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index 264ce9c..ce518a7 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -92,6 +92,8 @@ fi
 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
 	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 fi
+multibuild_export_phases \
+	python_prepare_all python_compile python_install python_install_all
 
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
@@ -559,6 +561,9 @@ distutils-r1_run_phase() {
 # If in-source build is used, the command will be run in the copy
 # of sources made for the best Python interpreter.
 _distutils-r1_run_common_phase() {
+	# not all phases need be set
+	[[ ${1} ]] || return
+
 	local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
 
 	local MULTIBUILD_VARIANTS
@@ -576,6 +581,9 @@ _distutils-r1_run_common_phase() {
 _distutils-r1_run_foreach_impl() {
 	debug-print-function ${FUNCNAME} "${@}"
 
+	# not all phases need be set
+	[[ ${1} ]] || return
+
 	set -- distutils-r1_run_phase "${@}"
 
 	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
@@ -599,68 +607,43 @@ _distutils-r1_run_foreach_impl() {
 distutils-r1_src_prepare() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	# common preparations
-	if declare -f python_prepare_all >/dev/null; then
-		python_prepare_all
-	else
-		distutils-r1_python_prepare_all
-	fi
-
-	if declare -f python_prepare >/dev/null; then
-		_distutils-r1_run_foreach_impl python_prepare
-	fi
+	"$(multibuild_get_phase_function python_prepare_all)"
+	_distutils-r1_run_foreach_impl \
+		"$(multibuild_get_phase_function python_prepare)"
 }
 
 distutils-r1_src_configure() {
-	if declare -f python_configure >/dev/null; then
-		_distutils-r1_run_foreach_impl python_configure
-	fi
-
-	if declare -f python_configure_all >/dev/null; then
-		_distutils-r1_run_common_phase python_configure_all
-	fi
+	_distutils-r1_run_foreach_impl \
+		"$(multibuild_get_phase_function python_configure)"
+	_distutils-r1_run_common_phase \
+		"$(multibuild_get_phase_function python_configure_all)"
 }
 
 distutils-r1_src_compile() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	if declare -f python_compile >/dev/null; then
-		_distutils-r1_run_foreach_impl python_compile
-	else
-		_distutils-r1_run_foreach_impl distutils-r1_python_compile
-	fi
-
-	if declare -f python_compile_all >/dev/null; then
-		_distutils-r1_run_common_phase python_compile_all
-	fi
+	_distutils-r1_run_foreach_impl \
+		"$(multibuild_get_phase_function python_compile)"
+	_distutils-r1_run_common_phase \
+		"$(multibuild_get_phase_function python_compile_all)"
 }
 
 distutils-r1_src_test() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	if declare -f python_test >/dev/null; then
-		_distutils-r1_run_foreach_impl python_test
-	fi
-
-	if declare -f python_test_all >/dev/null; then
-		_distutils-r1_run_common_phase python_test_all
-	fi
+	_distutils-r1_run_foreach_impl \
+		"$(multibuild_get_phase_function python_test)"
+	_distutils-r1_run_common_phase \
+		"$(multibuild_get_phase_function python_test_all)"
 }
 
 distutils-r1_src_install() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	if declare -f python_install >/dev/null; then
-		_distutils-r1_run_foreach_impl python_install
-	else
-		_distutils-r1_run_foreach_impl distutils-r1_python_install
-	fi
-
-	if declare -f python_install_all >/dev/null; then
-		_distutils-r1_run_common_phase python_install_all
-	else
-		_distutils-r1_run_common_phase distutils-r1_python_install_all
-	fi
+	_distutils-r1_run_foreach_impl \
+		"$(multibuild_get_phase_function python_install)"
+	_distutils-r1_run_common_phase \
+		"$(multibuild_get_phase_function python_install_all)"
 }
 
 _DISTUTILS_R1=1
-- 
1.8.1.5



  parent reply	other threads:[~2013-03-10 10:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-10 10:16 [gentoo-dev] [PATCHES] multibuild.eclass: custom phase function helpers Michał Górny
2013-03-10 10:18 ` [gentoo-dev] [PATCH 1/7] multibuild: introduce a generic framework for custom phase functions Michał Górny
2013-03-10 11:36   ` Ulrich Mueller
2013-03-10 12:16     ` Ulrich Mueller
2013-03-10 12:18       ` Ciaran McCreesh
2013-03-10 13:19         ` Michał Górny
2013-03-10 13:44           ` Ulrich Mueller
2013-03-10 13:48             ` Michał Górny
2013-03-10 15:26               ` Ciaran McCreesh
2013-03-10 15:46                 ` Michał Górny
2013-03-10 15:46                   ` Ciaran McCreesh
2013-03-10 15:50       ` [gentoo-dev] [PATCH] " Michał Górny
2013-03-10 18:37         ` Alec Warner
2013-03-10 10:18 ` Michał Górny [this message]
2013-03-10 10:18 ` [gentoo-dev] [PATCH 3/7] multilib-minimal: split out mkdir to unify sub-functions Michał Górny
2013-03-10 10:18 ` [gentoo-dev] [PATCH 4/7] multilib-minimal: reuse run_in_build_dir Michał Górny
2013-03-10 10:18 ` [gentoo-dev] [PATCH 5/7] multilib-minimal: reuse multibuild phase function handlers Michał Górny
2013-03-10 10:18 ` [gentoo-dev] [PATCH 6/7] multilib-minimal: run multilib_src_configure in parallel Michał Górny
2013-03-10 10:18 ` [gentoo-dev] [PATCH 7/7] autotools-multilib: reuse phase functions from multilib-minimal Michał Górny
2013-03-17 13:35 ` [gentoo-dev] [PATCHES] multibuild.eclass: custom phase function helpers Michał Górny

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=1362910691-8439-2-git-send-email-mgorny@gentoo.org \
    --to=mgorny@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=hasufell@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