Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: hasufell@g.o, python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/7] distutils-r1: use multibuild phase helpers.
Date: Sun, 10 Mar 2013 10:19:33
Message-Id: 1362910691-8439-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCHES] multibuild.eclass: custom phase function helpers by "Michał Górny"
1 ---
2 gx86/eclass/distutils-r1.eclass | 71 ++++++++++++++++-------------------------
3 1 file changed, 27 insertions(+), 44 deletions(-)
4
5 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
6 index 264ce9c..ce518a7 100644
7 --- a/gx86/eclass/distutils-r1.eclass
8 +++ b/gx86/eclass/distutils-r1.eclass
9 @@ -92,6 +92,8 @@ fi
10 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
11 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
12 fi
13 +multibuild_export_phases \
14 + python_prepare_all python_compile python_install python_install_all
15
16 if [[ ! ${_DISTUTILS_R1} ]]; then
17
18 @@ -559,6 +561,9 @@ distutils-r1_run_phase() {
19 # If in-source build is used, the command will be run in the copy
20 # of sources made for the best Python interpreter.
21 _distutils-r1_run_common_phase() {
22 + # not all phases need be set
23 + [[ ${1} ]] || return
24 +
25 local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
26
27 local MULTIBUILD_VARIANTS
28 @@ -576,6 +581,9 @@ _distutils-r1_run_common_phase() {
29 _distutils-r1_run_foreach_impl() {
30 debug-print-function ${FUNCNAME} "${@}"
31
32 + # not all phases need be set
33 + [[ ${1} ]] || return
34 +
35 set -- distutils-r1_run_phase "${@}"
36
37 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
38 @@ -599,68 +607,43 @@ _distutils-r1_run_foreach_impl() {
39 distutils-r1_src_prepare() {
40 debug-print-function ${FUNCNAME} "${@}"
41
42 - # common preparations
43 - if declare -f python_prepare_all >/dev/null; then
44 - python_prepare_all
45 - else
46 - distutils-r1_python_prepare_all
47 - fi
48 -
49 - if declare -f python_prepare >/dev/null; then
50 - _distutils-r1_run_foreach_impl python_prepare
51 - fi
52 + "$(multibuild_get_phase_function python_prepare_all)"
53 + _distutils-r1_run_foreach_impl \
54 + "$(multibuild_get_phase_function python_prepare)"
55 }
56
57 distutils-r1_src_configure() {
58 - if declare -f python_configure >/dev/null; then
59 - _distutils-r1_run_foreach_impl python_configure
60 - fi
61 -
62 - if declare -f python_configure_all >/dev/null; then
63 - _distutils-r1_run_common_phase python_configure_all
64 - fi
65 + _distutils-r1_run_foreach_impl \
66 + "$(multibuild_get_phase_function python_configure)"
67 + _distutils-r1_run_common_phase \
68 + "$(multibuild_get_phase_function python_configure_all)"
69 }
70
71 distutils-r1_src_compile() {
72 debug-print-function ${FUNCNAME} "${@}"
73
74 - if declare -f python_compile >/dev/null; then
75 - _distutils-r1_run_foreach_impl python_compile
76 - else
77 - _distutils-r1_run_foreach_impl distutils-r1_python_compile
78 - fi
79 -
80 - if declare -f python_compile_all >/dev/null; then
81 - _distutils-r1_run_common_phase python_compile_all
82 - fi
83 + _distutils-r1_run_foreach_impl \
84 + "$(multibuild_get_phase_function python_compile)"
85 + _distutils-r1_run_common_phase \
86 + "$(multibuild_get_phase_function python_compile_all)"
87 }
88
89 distutils-r1_src_test() {
90 debug-print-function ${FUNCNAME} "${@}"
91
92 - if declare -f python_test >/dev/null; then
93 - _distutils-r1_run_foreach_impl python_test
94 - fi
95 -
96 - if declare -f python_test_all >/dev/null; then
97 - _distutils-r1_run_common_phase python_test_all
98 - fi
99 + _distutils-r1_run_foreach_impl \
100 + "$(multibuild_get_phase_function python_test)"
101 + _distutils-r1_run_common_phase \
102 + "$(multibuild_get_phase_function python_test_all)"
103 }
104
105 distutils-r1_src_install() {
106 debug-print-function ${FUNCNAME} "${@}"
107
108 - if declare -f python_install >/dev/null; then
109 - _distutils-r1_run_foreach_impl python_install
110 - else
111 - _distutils-r1_run_foreach_impl distutils-r1_python_install
112 - fi
113 -
114 - if declare -f python_install_all >/dev/null; then
115 - _distutils-r1_run_common_phase python_install_all
116 - else
117 - _distutils-r1_run_common_phase distutils-r1_python_install_all
118 - fi
119 + _distutils-r1_run_foreach_impl \
120 + "$(multibuild_get_phase_function python_install)"
121 + _distutils-r1_run_common_phase \
122 + "$(multibuild_get_phase_function python_install_all)"
123 }
124
125 _DISTUTILS_R1=1
126 --
127 1.8.1.5