Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-r1: move entering BUILD_DIR into distutils-r1.
Date: Thu, 25 Oct 2012 21:15:14
Message-Id: 1351199713-23492-1-git-send-email-mgorny@gentoo.org
1 Currently, python_foreach_impl() enters BUILD_DIR which is not really
2 clean nor expected by users. It's better to have that in distutils-r1
3 directly where it is used with quasi-phase functions.
4 ---
5 gx86/eclass/distutils-r1.eclass | 33 +++++++++++++++++++++++----------
6 gx86/eclass/python-r1.eclass | 10 ----------
7 2 files changed, 23 insertions(+), 20 deletions(-)
8
9 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
10 index fdbd20b..6a6109d 100644
11 --- a/gx86/eclass/distutils-r1.eclass
12 +++ b/gx86/eclass/distutils-r1.eclass
13 @@ -286,6 +286,19 @@ distutils-r1_python_install_all() {
14 done
15 }
16
17 +# @FUNCTION: distutils-r1_run_phase
18 +# @USAGE: [<argv>...]
19 +# @INTERNAL
20 +# @DESCRIPTION:
21 +# Run the given command in BUILD_DIR.
22 +distutils-r1_run_phase() {
23 + debug-print-function ${FUNCNAME} "${@}"
24 +
25 + pushd "${BUILD_DIR}" &>/dev/null || die
26 + "${@}" || die "${1} failed."
27 + popd &>/dev/null || die
28 +}
29 +
30 distutils-r1_src_prepare() {
31 debug-print-function ${FUNCNAME} "${@}"
32
33 @@ -297,17 +310,17 @@ distutils-r1_src_prepare() {
34 fi
35
36 if declare -f python_prepare >/dev/null; then
37 - python_foreach_impl python_prepare
38 + python_foreach_impl distutils-r1_run_phase python_prepare
39 else
40 - python_foreach_impl distutils-r1_python_prepare
41 + python_foreach_impl distutils-r1_run_phase distutils-r1_python_prepare
42 fi
43 }
44
45 distutils-r1_src_configure() {
46 if declare -f python_configure >/dev/null; then
47 - python_foreach_impl python_configure
48 + python_foreach_impl distutils-r1_run_phase python_configure
49 else
50 - python_foreach_impl distutils-r1_python_configure
51 + python_foreach_impl distutils-r1_run_phase distutils-r1_python_configure
52 fi
53
54 if declare -f python_configure_all >/dev/null; then
55 @@ -319,9 +332,9 @@ distutils-r1_src_compile() {
56 debug-print-function ${FUNCNAME} "${@}"
57
58 if declare -f python_compile >/dev/null; then
59 - python_foreach_impl python_compile
60 + python_foreach_impl distutils-r1_run_phase python_compile
61 else
62 - python_foreach_impl distutils-r1_python_compile
63 + python_foreach_impl distutils-r1_run_phase distutils-r1_python_compile
64 fi
65
66 if declare -f python_compile_all >/dev/null; then
67 @@ -333,9 +346,9 @@ distutils-r1_src_test() {
68 debug-print-function ${FUNCNAME} "${@}"
69
70 if declare -f python_test >/dev/null; then
71 - python_foreach_impl python_test
72 + python_foreach_impl distutils-r1_run_phase python_test
73 else
74 - python_foreach_impl distutils-r1_python_test
75 + python_foreach_impl distutils-r1_run_phase distutils-r1_python_test
76 fi
77
78 if declare -f python_test_all >/dev/null; then
79 @@ -347,9 +360,9 @@ distutils-r1_src_install() {
80 debug-print-function ${FUNCNAME} "${@}"
81
82 if declare -f python_install >/dev/null; then
83 - python_foreach_impl python_install
84 + python_foreach_impl distutils-r1_run_phase python_install
85 else
86 - python_foreach_impl distutils-r1_python_install
87 + python_foreach_impl distutils-r1_run_phase distutils-r1_python_install
88 fi
89
90 if declare -f python_install_all >/dev/null; then
91 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
92 index d015cf2..43b1365 100644
93 --- a/gx86/eclass/python-r1.eclass
94 +++ b/gx86/eclass/python-r1.eclass
95 @@ -330,11 +330,6 @@ python_copy_sources() {
96 #
97 # For each command being run, EPYTHON, PYTHON and BUILD_DIR are set
98 # locally, and the former two are exported to the command environment.
99 -#
100 -# The command is run inside the build directory. If it doesn't exist
101 -# yet, it is created (as an empty directory!). If your build system does
102 -# not support out-of-source builds, you will likely want to use
103 -# python_copy_sources first.
104 python_foreach_impl() {
105 debug-print-function ${FUNCNAME} "${@}"
106
107 @@ -350,13 +345,8 @@ python_foreach_impl() {
108 local BUILD_DIR=${bdir%%/}-${impl}
109 export EPYTHON PYTHON
110
111 - debug-print "${FUNCNAME}: [${impl}] build_dir = ${BUILD_DIR}"
112 -
113 - mkdir -p "${BUILD_DIR}" || die
114 - pushd "${BUILD_DIR}" &>/dev/null || die
115 einfo "${EPYTHON}: running ${@}"
116 "${@}" || die "${EPYTHON}: ${1} failed"
117 - popd &>/dev/null || die
118 fi
119 done
120 }
121 --
122 1.7.12.4