1 |
mgorny 12/12/01 09:29:25 |
2 |
|
3 |
Modified: python-single-r1.eclass python-r1.eclass ChangeLog |
4 |
Added: python-any-r1.eclass |
5 |
Log: |
6 |
Introduce python-any-r1, to handle packages satisfied by any Python implementation installed (e.g. strictly build-time dependent). |
7 |
|
8 |
Revision Changes Path |
9 |
1.7 eclass/python-single-r1.eclass |
10 |
|
11 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?rev=1.7&view=markup |
12 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?rev=1.7&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?r1=1.6&r2=1.7 |
14 |
|
15 |
Index: python-single-r1.eclass |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v |
18 |
retrieving revision 1.6 |
19 |
retrieving revision 1.7 |
20 |
diff -u -r1.6 -r1.7 |
21 |
--- python-single-r1.eclass 30 Nov 2012 22:57:26 -0000 1.6 |
22 |
+++ python-single-r1.eclass 1 Dec 2012 09:29:24 -0000 1.7 |
23 |
@@ -1,6 +1,6 @@ |
24 |
# Copyright 1999-2012 Gentoo Foundation |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.6 2012/11/30 22:57:26 mgorny Exp $ |
27 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.7 2012/12/01 09:29:24 mgorny Exp $ |
28 |
|
29 |
# @ECLASS: python-single-r1 |
30 |
# @MAINTAINER: |
31 |
@@ -47,6 +47,8 @@ |
32 |
|
33 |
if [[ ${_PYTHON_R1} ]]; then |
34 |
die 'python-single-r1.eclass can not be used with python-r1.eclass.' |
35 |
+elif [[ ${_PYTHON_ANY_R1} ]]; then |
36 |
+ die 'python-single-r1.eclass can not be used with python-any-r1.eclass.' |
37 |
fi |
38 |
|
39 |
inherit python-utils-r1 |
40 |
|
41 |
|
42 |
|
43 |
1.25 eclass/python-r1.eclass |
44 |
|
45 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.25&view=markup |
46 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?rev=1.25&content-type=text/plain |
47 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-r1.eclass?r1=1.24&r2=1.25 |
48 |
|
49 |
Index: python-r1.eclass |
50 |
=================================================================== |
51 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v |
52 |
retrieving revision 1.24 |
53 |
retrieving revision 1.25 |
54 |
diff -u -r1.24 -r1.25 |
55 |
--- python-r1.eclass 30 Nov 2012 11:40:15 -0000 1.24 |
56 |
+++ python-r1.eclass 1 Dec 2012 09:29:24 -0000 1.25 |
57 |
@@ -1,6 +1,6 @@ |
58 |
# Copyright 1999-2012 Gentoo Foundation |
59 |
# Distributed under the terms of the GNU General Public License v2 |
60 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.24 2012/11/30 11:40:15 mgorny Exp $ |
61 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.25 2012/12/01 09:29:24 mgorny Exp $ |
62 |
|
63 |
# @ECLASS: python-r1 |
64 |
# @MAINTAINER: |
65 |
@@ -44,6 +44,8 @@ |
66 |
|
67 |
if [[ ${_PYTHON_SINGLE_R1} ]]; then |
68 |
die 'python-r1.eclass can not be used with python-single-r1.eclass.' |
69 |
+elif [[ ${_PYTHON_ANY_R1} ]]; then |
70 |
+ die 'python-r1.eclass can not be used with python-any-r1.eclass.' |
71 |
fi |
72 |
|
73 |
inherit python-utils-r1 |
74 |
|
75 |
|
76 |
|
77 |
1.533 eclass/ChangeLog |
78 |
|
79 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.533&view=markup |
80 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.533&content-type=text/plain |
81 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.532&r2=1.533 |
82 |
|
83 |
Index: ChangeLog |
84 |
=================================================================== |
85 |
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v |
86 |
retrieving revision 1.532 |
87 |
retrieving revision 1.533 |
88 |
diff -u -r1.532 -r1.533 |
89 |
--- ChangeLog 30 Nov 2012 22:57:26 -0000 1.532 |
90 |
+++ ChangeLog 1 Dec 2012 09:29:24 -0000 1.533 |
91 |
@@ -1,6 +1,11 @@ |
92 |
# ChangeLog for eclass directory |
93 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
94 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.532 2012/11/30 22:57:26 mgorny Exp $ |
95 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.533 2012/12/01 09:29:24 mgorny Exp $ |
96 |
+ |
97 |
+ 01 Dec 2012; Michał Górny <mgorny@g.o> +python-any-r1.eclass, |
98 |
+ python-r1.eclass, python-single-r1.eclass: |
99 |
+ Introduce python-any-r1, to handle packages satisfied by any Python |
100 |
+ implementation installed (e.g. strictly build-time dependent). |
101 |
|
102 |
30 Nov 2012; Michał Górny <mgorny@g.o> python-single-r1.eclass: |
103 |
Add missing REQUIRED_USE constraints to enforce PYTHON_SINGLE_TARGET being in |
104 |
|
105 |
|
106 |
|
107 |
1.1 eclass/python-any-r1.eclass |
108 |
|
109 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-any-r1.eclass?rev=1.1&view=markup |
110 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-any-r1.eclass?rev=1.1&content-type=text/plain |
111 |
|
112 |
Index: python-any-r1.eclass |
113 |
=================================================================== |
114 |
# Copyright 1999-2012 Gentoo Foundation |
115 |
# Distributed under the terms of the GNU General Public License v2 |
116 |
# $Header: /var/cvsroot/gentoo-x86/eclass/python-any-r1.eclass,v 1.1 2012/12/01 09:29:24 mgorny Exp $ |
117 |
|
118 |
# @ECLASS: python-any-r1 |
119 |
# @MAINTAINER: |
120 |
# Michał Górny <mgorny@g.o> |
121 |
# Python herd <python@g.o> |
122 |
# @AUTHOR: |
123 |
# Author: Michał Górny <mgorny@g.o> |
124 |
# Based on work of: Krzysztof Pawlik <nelchael@g.o> |
125 |
# @BLURB: An eclass for packages having build-time dependency on Python. |
126 |
# @DESCRIPTION: |
127 |
# A minimal eclass for packages which need any Python interpreter |
128 |
# installed without a need for explicit choice and invariability. |
129 |
# This usually involves packages requiring Python at build-time |
130 |
# but having no other relevance to it. |
131 |
# |
132 |
# This eclass provides a minimal PYTHON_DEPS variable with a dependency |
133 |
# string on any of the supported Python implementations. It also exports |
134 |
# pkg_setup() which finds the best supported implementation and sets it |
135 |
# as the active one. |
136 |
# |
137 |
# Please note that python-any-r1 will always inherit python-utils-r1 |
138 |
# as well. Thus, all the functions defined there can be used in the |
139 |
# packages using python-any-r1, and there is no need ever to inherit |
140 |
# both. |
141 |
# |
142 |
# For more information, please see the python-r1 Developer's Guide: |
143 |
# http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml |
144 |
|
145 |
case "${EAPI:-0}" in |
146 |
0|1|2|3|4|5) |
147 |
# EAPI=4 needed by python-r1 |
148 |
;; |
149 |
*) |
150 |
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" |
151 |
;; |
152 |
esac |
153 |
|
154 |
if [[ ! ${_PYTHON_ANY_R1} ]]; then |
155 |
|
156 |
if [[ ${_PYTHON_R1} ]]; then |
157 |
die 'python-any-r1.eclass can not be used with python-r1.eclass.' |
158 |
elif [[ ${_PYTHON_SINGLE_R1} ]]; then |
159 |
die 'python-any-r1.eclass can not be used with python-single-r1.eclass.' |
160 |
fi |
161 |
|
162 |
inherit python-utils-r1 |
163 |
|
164 |
fi |
165 |
|
166 |
EXPORT_FUNCTIONS pkg_setup |
167 |
|
168 |
if [[ ! ${_PYTHON_ANY_R1} ]]; then |
169 |
|
170 |
# @ECLASS-VARIABLE: PYTHON_COMPAT |
171 |
# @REQUIRED |
172 |
# @DESCRIPTION: |
173 |
# This variable contains a list of Python implementations the package |
174 |
# supports. It must be set before the `inherit' call. It has to be |
175 |
# an array. |
176 |
# |
177 |
# Example: |
178 |
# @CODE |
179 |
# PYTHON_COMPAT=( python{2_5,2_6,2_7} ) |
180 |
# @CODE |
181 |
if ! declare -p PYTHON_COMPAT &>/dev/null; then |
182 |
die 'PYTHON_COMPAT not declared.' |
183 |
fi |
184 |
|
185 |
# @ECLASS-VARIABLE: PYTHON_REQ_USE |
186 |
# @DEFAULT_UNSET |
187 |
# @DESCRIPTION: |
188 |
# The list of USEflags required to be enabled on the Python |
189 |
# implementations, formed as a USE-dependency string. It should be valid |
190 |
# for all implementations in PYTHON_COMPAT, so it may be necessary to |
191 |
# use USE defaults. |
192 |
# |
193 |
# Example: |
194 |
# @CODE |
195 |
# PYTHON_REQ_USE="gdbm,ncurses(-)?" |
196 |
# @CODE |
197 |
# |
198 |
# It will cause the Python dependencies to look like: |
199 |
# @CODE |
200 |
# || ( dev-lang/python:X.Y[gdbm,ncurses(-)?] ... ) |
201 |
# @CODE |
202 |
|
203 |
# @ECLASS-VARIABLE: PYTHON_DEPS |
204 |
# @DESCRIPTION: |
205 |
# This is an eclass-generated Python dependency string for all |
206 |
# implementations listed in PYTHON_COMPAT. |
207 |
# |
208 |
# Any of the supported interpreters will satisfy the dependency. |
209 |
# |
210 |
# Example use: |
211 |
# @CODE |
212 |
# DEPEND="${RDEPEND} |
213 |
# ${PYTHON_DEPS}" |
214 |
# @CODE |
215 |
# |
216 |
# Example value: |
217 |
# @CODE |
218 |
# || ( dev-lang/python:2.7[gdbm] |
219 |
# dev-lang/python:2.6[gdbm] ) |
220 |
# @CODE |
221 |
|
222 |
_python_build_set_globals() { |
223 |
local usestr |
224 |
[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]" |
225 |
|
226 |
PYTHON_DEPS= |
227 |
local i |
228 |
for i in "${_PYTHON_ALL_IMPLS[@]}"; do |
229 |
if has "${i}" "${PYTHON_COMPAT[@]}" |
230 |
then |
231 |
local d |
232 |
case ${i} in |
233 |
python*) |
234 |
d='dev-lang/python';; |
235 |
jython*) |
236 |
d='dev-java/jython';; |
237 |
pypy*) |
238 |
d='dev-python/pypy';; |
239 |
*) |
240 |
die "Invalid implementation: ${i}" |
241 |
esac |
242 |
|
243 |
local v=${i##*[a-z]} |
244 |
PYTHON_DEPS="${d}:${v/_/.}${usestr} ${PYTHON_DEPS}" |
245 |
fi |
246 |
done |
247 |
PYTHON_DEPS="|| ( ${PYTHON_DEPS})" |
248 |
} |
249 |
_python_build_set_globals |
250 |
|
251 |
# @FUNCTION: python-any-r1_pkg_setup |
252 |
# @DESCRIPTION: |
253 |
# Determine what the best installed (and supported) Python |
254 |
# implementation is and set EPYTHON and PYTHON accordingly. |
255 |
python-any-r1_pkg_setup() { |
256 |
debug-print-function ${FUNCNAME} "${@}" |
257 |
|
258 |
local i rev_impls=() |
259 |
for i in "${_PYTHON_ALL_IMPLS[@]}"; do |
260 |
if has "${i}" "${PYTHON_COMPAT[@]}"; then |
261 |
rev_impls=( "${i}" "${rev_impls[@]}" ) |
262 |
fi |
263 |
done |
264 |
|
265 |
for i in "${rev_impls[@]}"; do |
266 |
local d |
267 |
case "${i}" in |
268 |
python*) |
269 |
d='dev-lang/python';; |
270 |
jython*) |
271 |
d='dev-java/jython';; |
272 |
pypy*) |
273 |
d='dev-python/pypy';; |
274 |
*) |
275 |
die "Invalid implementation: ${i}" |
276 |
esac |
277 |
local v=${i##*[a-z]} |
278 |
|
279 |
if has_version "${d}:${v/_/.}${usestr}"; then |
280 |
python_export "${i}" EPYTHON PYTHON |
281 |
break |
282 |
fi |
283 |
done |
284 |
} |
285 |
|
286 |
_PYTHON_ANY_R1=1 |
287 |
fi |