1 |
--- |
2 |
gx86/eclass/distutils-r1.eclass | 48 ++++++++++++++++++---- |
3 |
gx86/eclass/python-r1.eclass | 91 ++++++++++++++++++++++++++++++++++++----- |
4 |
2 files changed, 120 insertions(+), 19 deletions(-) |
5 |
|
6 |
diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass |
7 |
index 2ab80ae..1b734b2 100644 |
8 |
--- a/gx86/eclass/distutils-r1.eclass |
9 |
+++ b/gx86/eclass/distutils-r1.eclass |
10 |
@@ -1,6 +1,6 @@ |
11 |
# Copyright 1999-2012 Gentoo Foundation |
12 |
# Distributed under the terms of the GNU General Public License v2 |
13 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.3 2012/10/15 15:01:18 mgorny Exp $ |
14 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.4 2012/10/19 19:55:46 mgorny Exp $ |
15 |
|
16 |
# @ECLASS: distutils-r1 |
17 |
# @MAINTAINER: |
18 |
@@ -34,7 +34,12 @@ |
19 |
# functions, you should consider calling the defaults (and especially |
20 |
# distutils-r1_python_prepare_all). |
21 |
# |
22 |
-# Please note that distutils-r1 sets RDEPEND and DEPEND for you. |
23 |
+# Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally |
24 |
+# for you. |
25 |
+# |
26 |
+# Also, please note that distutils-r1 will always inherit python-r1 |
27 |
+# as well. Thus, all the variables defined and documented there are |
28 |
+# relevant to the packages using distutils-r1. |
29 |
|
30 |
case "${EAPI}" in |
31 |
0|1|2|3) |
32 |
@@ -55,12 +60,32 @@ RDEPEND="${PYTHON_DEPS} |
33 |
dev-python/python-exec" |
34 |
DEPEND=${PYTHON_DEPS} |
35 |
|
36 |
+# @ECLASS-VARIABLE: PATCHES |
37 |
+# @DEFAULT_UNSET |
38 |
+# @DESCRIPTION: |
39 |
+# An array containing patches to be applied to the sources before |
40 |
+# copying them. |
41 |
+# |
42 |
+# If unset, no custom patches will be applied. |
43 |
+# |
44 |
+# Please note, however, that at some point the eclass may apply |
45 |
+# additional distutils patches/quirks independently of this variable. |
46 |
+# |
47 |
+# Example: |
48 |
+# @CODE |
49 |
+# PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch ) |
50 |
+# @CODE |
51 |
+ |
52 |
# @ECLASS-VARIABLE: DOCS |
53 |
# @DEFAULT_UNSET |
54 |
# @DESCRIPTION: |
55 |
-# Array containing documents installed using dodoc. |
56 |
+# An array containing documents installed using dodoc. The files listed |
57 |
+# there must exist in the directory from which |
58 |
+# distutils-r1_python_install_all() is run (${S} by default). |
59 |
# |
60 |
-# If unset, the default filename list (from PMS) will be used. |
61 |
+# If unset, the function will instead look up files matching default |
62 |
+# filename pattern list (from the Package Manager Specification), |
63 |
+# and install those found. |
64 |
# |
65 |
# Example: |
66 |
# @CODE |
67 |
@@ -70,7 +95,11 @@ DEPEND=${PYTHON_DEPS} |
68 |
# @ECLASS-VARIABLE: HTML_DOCS |
69 |
# @DEFAULT_UNSET |
70 |
# @DESCRIPTION: |
71 |
-# Array containing documents installed using dohtml. |
72 |
+# An array containing documents installed using dohtml. The files |
73 |
+# and directories listed there must exist in the directory from which |
74 |
+# distutils-r1_python_install_all() is run (${S} by default). |
75 |
+# |
76 |
+# If unset, no HTML docs will be installed. |
77 |
# |
78 |
# Example: |
79 |
# @CODE |
80 |
@@ -82,6 +111,9 @@ DEPEND=${PYTHON_DEPS} |
81 |
# The default python_prepare_all(). It applies the patches from PATCHES |
82 |
# array, then user patches and finally calls python_copy_sources to |
83 |
# create copies of resulting sources for each Python implementation. |
84 |
+# |
85 |
+# At some point in the future, it may also apply eclass-specific |
86 |
+# distutils patches and/or quirks. |
87 |
distutils-r1_python_prepare_all() { |
88 |
debug-print-function ${FUNCNAME} "${@}" |
89 |
|
90 |
@@ -267,7 +299,7 @@ distutils-r1_src_prepare() { |
91 |
if declare -f python_prepare >/dev/null; then |
92 |
python_foreach_impl python_prepare |
93 |
else |
94 |
- distutils-r1_python_prepare |
95 |
+ python_foreach_impl distutils-r1_python_prepare |
96 |
fi |
97 |
} |
98 |
|
99 |
@@ -275,7 +307,7 @@ distutils-r1_src_configure() { |
100 |
if declare -f python_configure >/dev/null; then |
101 |
python_foreach_impl python_configure |
102 |
else |
103 |
- distutils-r1_python_configure |
104 |
+ python_foreach_impl distutils-r1_python_configure |
105 |
fi |
106 |
|
107 |
if declare -f python_configure_all >/dev/null; then |
108 |
@@ -303,7 +335,7 @@ distutils-r1_src_test() { |
109 |
if declare -f python_test >/dev/null; then |
110 |
python_foreach_impl python_test |
111 |
else |
112 |
- distutils-r1_python_test |
113 |
+ python_foreach_impl distutils-r1_python_test |
114 |
fi |
115 |
|
116 |
if declare -f python_test_all >/dev/null; then |
117 |
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass |
118 |
index e305ce2..89fc0e7 100644 |
119 |
--- a/gx86/eclass/python-r1.eclass |
120 |
+++ b/gx86/eclass/python-r1.eclass |
121 |
@@ -19,6 +19,10 @@ |
122 |
# and PYTHON_USEDEP so you can create correct dependencies for your |
123 |
# package easily. It also provides methods to easily run a command for |
124 |
# each enabled Python implementation and duplicate the sources for them. |
125 |
+# |
126 |
+# Please note that this eclass is mostly intended to be extended |
127 |
+# on-request. If you find something you used in other eclasses missing, |
128 |
+# please don't hack it around and request an enhancement instead. |
129 |
|
130 |
case "${EAPI}" in |
131 |
0|1|2|3) |
132 |
@@ -46,8 +50,17 @@ _PYTHON_ALL_IMPLS=( |
133 |
# @ECLASS-VARIABLE: PYTHON_COMPAT |
134 |
# @DESCRIPTION: |
135 |
# This variable contains a list of Python implementations the package |
136 |
-# supports. It must be set before the `inherit' call. The default is to |
137 |
-# enable all implementations. It has to be an array. |
138 |
+# supports. It must be set before the `inherit' call. It has to be |
139 |
+# an array. |
140 |
+# |
141 |
+# The default is to enable all supported implementations. However, it is |
142 |
+# discouraged to use that default unless in very special cases and test |
143 |
+# the package with each added implementation instead. |
144 |
+# |
145 |
+# Example: |
146 |
+# @CODE |
147 |
+# PYTHON_COMPAT=( python2_5 python2_6 python2_7 ) |
148 |
+# @CODE |
149 |
if ! declare -p PYTHON_COMPAT &>/dev/null; then |
150 |
PYTHON_COMPAT=( "${_PYTHON_ALL_IMPLS[@]}" ) |
151 |
fi |
152 |
@@ -65,7 +78,7 @@ fi |
153 |
# PYTHON_REQ_USE="gdbm,ncurses(-)?" |
154 |
# @CODE |
155 |
# |
156 |
-# Will cause the Python dependencies to look like: |
157 |
+# It will cause the Python dependencies to look like: |
158 |
# @CODE |
159 |
# python_targets_pythonX_Y? ( |
160 |
# dev-lang/python:X_Y[gdbm,ncurses(-)?] ) |
161 |
@@ -74,24 +87,40 @@ fi |
162 |
# @ECLASS-VARIABLE: PYTHON_DEPS |
163 |
# @DESCRIPTION: |
164 |
# This is an eclass-generated Python dependency string for all |
165 |
-# implementations listed in PYTHON_COMPAT. It should be used |
166 |
-# in RDEPEND and/or DEPEND like: |
167 |
+# implementations listed in PYTHON_COMPAT. |
168 |
# |
169 |
+# Example use: |
170 |
# @CODE |
171 |
# RDEPEND="${PYTHON_DEPS} |
172 |
# dev-foo/mydep" |
173 |
# DEPEND="${RDEPEND}" |
174 |
# @CODE |
175 |
+# |
176 |
+# Example value: |
177 |
+# @CODE |
178 |
+# python_targets2_6? ( dev-lang/python:2.6[gdbm] ) |
179 |
+# python_targets2_7? ( dev-lang/python:2.7[gdbm] ) |
180 |
+# @CODE |
181 |
|
182 |
# @ECLASS-VARIABLE: PYTHON_USEDEP |
183 |
# @DESCRIPTION: |
184 |
# This is an eclass-generated USE-dependency string which can be used to |
185 |
# depend on another Python package being built for the same Python |
186 |
-# implementations. It should be used like: |
187 |
+# implementations. |
188 |
+# |
189 |
+# The generate USE-flag list is compatible with packages using python-r1 |
190 |
+# and python-distutils-ng eclasses. It must not be used on packages |
191 |
+# using python.eclass. |
192 |
# |
193 |
+# Example use: |
194 |
# @CODE |
195 |
# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]" |
196 |
# @CODE |
197 |
+# |
198 |
+# Example value: |
199 |
+# @CODE |
200 |
+# python_targets_python2_6?,python_targets_python2_7? |
201 |
+# @CODE |
202 |
|
203 |
_python_set_globals() { |
204 |
local flags=( "${PYTHON_COMPAT[@]/#/python_targets_}" ) |
205 |
@@ -153,10 +182,52 @@ _python_set_PYTHON() { |
206 |
debug-print "${FUNCNAME}: ${impl} -> ${PYTHON}" |
207 |
} |
208 |
|
209 |
+# @ECLASS-VARIABLE: BUILD_DIR |
210 |
+# @DESCRIPTION: |
211 |
+# The current build directory. In global scope, it is supposed to |
212 |
+# contain an initial build directory; if unset, it defaults to ${S}. |
213 |
+# |
214 |
+# In functions run by python_foreach_impl(), the BUILD_DIR is locally |
215 |
+# set to an implementation-specific build directory. That path is |
216 |
+# created through appending a hyphen and the implementation name |
217 |
+# to the final component of the initial BUILD_DIR. |
218 |
+# |
219 |
+# Example value: |
220 |
+# @CODE |
221 |
+# ${WORKDIR}/foo-1.3-python2_6 |
222 |
+# @CODE |
223 |
+ |
224 |
+# @ECLASS-VARIABLE: PYTHON |
225 |
+# @DESCRIPTION: |
226 |
+# The absolute path to the current Python interpreter. |
227 |
+# |
228 |
+# Set and exported only in commands run by python_foreach_impl(). |
229 |
+# |
230 |
+# Example value: |
231 |
+# @CODE |
232 |
+# /usr/bin/python2.6 |
233 |
+# @CODE |
234 |
+ |
235 |
+# @ECLASS-VARIABLE: EPYTHON |
236 |
+# @DESCRIPTION: |
237 |
+# The executable name of the current Python interpreter. |
238 |
+# |
239 |
+# This variable is used consistently with python.eclass. |
240 |
+# |
241 |
+# Set and exported only in commands run by python_foreach_impl(). |
242 |
+# |
243 |
+# Example value: |
244 |
+# @CODE |
245 |
+# python2.6 |
246 |
+# @CODE |
247 |
+ |
248 |
# @FUNCTION: python_copy_sources |
249 |
# @DESCRIPTION: |
250 |
# Create a single copy of the package sources (${S}) for each enabled |
251 |
# Python implementation. |
252 |
+# |
253 |
+# The sources are always copied from S to implementation-specific build |
254 |
+# directories respecting BUILD_DIR. |
255 |
python_copy_sources() { |
256 |
debug-print-function ${FUNCNAME} "${@}" |
257 |
|
258 |
@@ -186,10 +257,8 @@ python_copy_sources() { |
259 |
# to the command. If the command fails, python_foreach_impl dies. |
260 |
# If necessary, use ':' to force a successful return. |
261 |
# |
262 |
-# Before the command is run, EPYTHON is set to the name of the current |
263 |
-# Python implementation, PYTHON is set to the correct Python executable |
264 |
-# name and exported, and BUILD_DIR is set to a 'default' build directory |
265 |
-# for given implementation (e.g. ${BUILD_DIR:-${S}}-python2_7). |
266 |
+# For each command being run, EPYTHON, PYTHON and BUILD_DIR are set |
267 |
+# locally, and the former two are exported to the command environment. |
268 |
# |
269 |
# The command is run inside the build directory. If it doesn't exist |
270 |
# yet, it is created (as an empty directory!). If your build system does |
271 |
@@ -208,7 +277,7 @@ python_foreach_impl() { |
272 |
local EPYTHON PYTHON |
273 |
_python_set_PYTHON "${impl}" |
274 |
local BUILD_DIR=${bdir%%/}-${impl} |
275 |
- export PYTHON |
276 |
+ export EPYTHON PYTHON |
277 |
|
278 |
debug-print "${FUNCNAME}: [${impl}] build_dir = ${BUILD_DIR}" |
279 |
|
280 |
-- |
281 |
1.7.12.4 |