Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: distutils-r1.eclass ChangeLog
Date: Mon, 29 Oct 2012 13:34:13
Message-Id: 20121029133402.39B3321600@flycatcher.gentoo.org
1 mgorny 12/10/29 13:34:02
2
3 Modified: distutils-r1.eclass ChangeLog
4 Log:
5 Support and use out-of-source builds by default.
6
7 Revision Changes Path
8 1.14 eclass/distutils-r1.eclass
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.14&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.14&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.13&r2=1.14
13
14 Index: distutils-r1.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
17 retrieving revision 1.13
18 retrieving revision 1.14
19 diff -u -r1.13 -r1.14
20 --- distutils-r1.eclass 29 Oct 2012 13:30:48 -0000 1.13
21 +++ distutils-r1.eclass 29 Oct 2012 13:34:02 -0000 1.14
22 @@ -1,6 +1,6 @@
23 # Copyright 1999-2012 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.13 2012/10/29 13:30:48 mgorny Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.14 2012/10/29 13:34:02 mgorny Exp $
27
28 # @ECLASS: distutils-r1
29 # @MAINTAINER:
30 @@ -105,6 +105,22 @@
31 # HTML_DOCS=( doc/html/ )
32 # @CODE
33
34 +# @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
35 +# @DEFAULT_UNSET
36 +# @DESCRIPTION:
37 +# If set to a non-null value, in-source builds will be enabled.
38 +# If unset, the default is to use in-source builds when python_prepare()
39 +# is declared, and out-of-source builds otherwise.
40 +#
41 +# If in-source builds are used, the eclass will create a copy of package
42 +# sources for each Python implementation in python_prepare_all(),
43 +# and work on that copy afterwards.
44 +#
45 +# If out-of-source builds are used, the eclass will instead work
46 +# on the sources directly, prepending setup.py arguments with
47 +# 'build --build-base ${BUILD_DIR}' to enforce keeping & using built
48 +# files in the specific root.
49 +
50 # @ECLASS-VARIABLE: mydistutilsargs
51 # @DEFAULT_UNSET
52 # @DESCRIPTION:
53 @@ -129,8 +145,17 @@
54 esetup.py() {
55 debug-print-function ${FUNCNAME} "${@}"
56
57 + local args=()
58 + if [[ ! ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
59 + if [[ ! ${BUILD_DIR} ]]; then
60 + die 'Out-of-source build requested, yet BUILD_DIR unset.'
61 + fi
62 +
63 + args+=( build --build-base "${BUILD_DIR}" )
64 + fi
65 +
66 set -- "${PYTHON:-python}" setup.py \
67 - "${mydistutilsargs[@]}" "${@}"
68 + "${args[@]}" "${mydistutilsargs[@]}" "${@}"
69
70 echo "${@}" >&2
71 "${@}" || die
72 @@ -151,8 +176,17 @@
73
74 epatch_user
75
76 - # create source copies for each implementation
77 - python_copy_sources
78 + # by default, use in-source build if python_prepare() is used
79 + if [[ ! ${DISTUTILS_IN_SOURCE_BUILD+1} ]]; then
80 + if declare -f python_prepare >/dev/null; then
81 + DISTUTILS_IN_SOURCE_BUILD=1
82 + fi
83 + fi
84 +
85 + if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
86 + # create source copies for each implementation
87 + python_copy_sources
88 + fi
89 }
90
91 # @FUNCTION: distutils-r1_python_prepare
92 @@ -296,9 +330,15 @@
93 distutils-r1_run_phase() {
94 debug-print-function ${FUNCNAME} "${@}"
95
96 - pushd "${BUILD_DIR}" &>/dev/null || die
97 + if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
98 + pushd "${BUILD_DIR}" &>/dev/null || die
99 + fi
100 +
101 "${@}" || die "${1} failed."
102 - popd &>/dev/null || die
103 +
104 + if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
105 + popd &>/dev/null || die
106 + fi
107 }
108
109 distutils-r1_src_prepare() {
110
111
112
113 1.484 eclass/ChangeLog
114
115 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.484&view=markup
116 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.484&content-type=text/plain
117 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.483&r2=1.484
118
119 Index: ChangeLog
120 ===================================================================
121 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
122 retrieving revision 1.483
123 retrieving revision 1.484
124 diff -u -r1.483 -r1.484
125 --- ChangeLog 29 Oct 2012 13:30:48 -0000 1.483
126 +++ ChangeLog 29 Oct 2012 13:34:02 -0000 1.484
127 @@ -1,6 +1,9 @@
128 # ChangeLog for eclass directory
129 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
130 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.483 2012/10/29 13:30:48 mgorny Exp $
131 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.484 2012/10/29 13:34:02 mgorny Exp $
132 +
133 + 29 Oct 2012; Michał Górny <mgorny@g.o> distutils-r1.eclass:
134 + Support and use out-of-source builds by default.
135
136 29 Oct 2012; Michał Górny <mgorny@g.o> distutils-r1.eclass:
137 Introduce an esetup.py wrapper function and mydistutilsargs=() for it.