Gentoo Archives: gentoo-python

From: Dirkjan Ochtman <djc@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-python <gentoo-python@l.g.o>, Gentoo Python Project <python@g.o>
Subject: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
Date: Wed, 28 Nov 2012 12:25:53
Message-Id: CAKmKYaCjZThNF+sZHKPohZWvqPD1kYrKDLe+We5s+bqwhMeGDA@mail.gmail.com
In Reply to: [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone. by "Michał Górny"
1 Patches 1 and 2 look good to me. Patch 3 looks like it merits some
2 higher-level design discussion?
3
4 On Wed, Nov 28, 2012 at 1:13 PM, Michał Górny <mgorny@g.o> wrote:
5 > It's not that good idea to inherit python-r1 there, so let's just make
6 > it work on its own.
7 >
8 > Also, duplicate the docs so that people could find them easily.
9 > ---
10 > gx86/eclass/python-r1.eclass | 11 ----
11 > gx86/eclass/python-single-r1.eclass | 114 ++++++++++++++++++++++++++++--------
12 > gx86/eclass/python-utils-r1.eclass | 11 ++++
13 > 3 files changed, 100 insertions(+), 36 deletions(-)
14 >
15 > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
16 > index c989690..9a02df3 100644
17 > --- a/gx86/eclass/python-r1.eclass
18 > +++ b/gx86/eclass/python-r1.eclass
19 > @@ -44,17 +44,6 @@ if [[ ! ${_PYTHON_R1} ]]; then
20 >
21 > inherit python-utils-r1
22 >
23 > -# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
24 > -# @INTERNAL
25 > -# @DESCRIPTION:
26 > -# All supported Python implementations, most preferred last.
27 > -_PYTHON_ALL_IMPLS=(
28 > - jython2_5
29 > - pypy1_8 pypy1_9
30 > - python3_1 python3_2 python3_3
31 > - python2_5 python2_6 python2_7
32 > -)
33 > -
34 > # @ECLASS-VARIABLE: PYTHON_COMPAT
35 > # @REQUIRED
36 > # @DESCRIPTION:
37 > diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
38 > index 1fdf803..3aa350b 100644
39 > --- a/gx86/eclass/python-single-r1.eclass
40 > +++ b/gx86/eclass/python-single-r1.eclass
41 > @@ -23,9 +23,10 @@
42 > # (using python-r1 eclass) can not depend on packages not supporting
43 > # them (using this eclass).
44 > #
45 > -# Also, please note that python-single-r1 will always inherit python-r1
46 > -# as well. Thus, all the variables defined there are relevant
47 > -# to the packages using python-single-r1.
48 > +# Please note that python-r1 will always inherit python-utils-r1 as
49 > +# well. Thus, all the functions defined there can be used
50 > +# in the packages using python-r1, and there is no need ever to inherit
51 > +# both.
52 > #
53 > # For more information, please see the python-r1 Developer's Guide:
54 > # http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
55 > @@ -44,7 +45,7 @@ esac
56 >
57 > if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
58 >
59 > -inherit python-r1
60 > +inherit python-utils-r1
61 >
62 > fi
63 >
64 > @@ -52,13 +53,89 @@ EXPORT_FUNCTIONS pkg_setup
65 >
66 > if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
67 >
68 > +# @ECLASS-VARIABLE: PYTHON_COMPAT
69 > +# @REQUIRED
70 > +# @DESCRIPTION:
71 > +# This variable contains a list of Python implementations the package
72 > +# supports. It must be set before the `inherit' call. It has to be
73 > +# an array.
74 > +#
75 > +# Example:
76 > +# @CODE
77 > +# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
78 > +# @CODE
79 > +if ! declare -p PYTHON_COMPAT &>/dev/null; then
80 > + die 'PYTHON_COMPAT not declared.'
81 > +fi
82 > +
83 > +# @ECLASS-VARIABLE: PYTHON_REQ_USE
84 > +# @DEFAULT_UNSET
85 > +# @DESCRIPTION:
86 > +# The list of USEflags required to be enabled on the chosen Python
87 > +# implementations, formed as a USE-dependency string. It should be valid
88 > +# for all implementations in PYTHON_COMPAT, so it may be necessary to
89 > +# use USE defaults.
90 > +#
91 > +# Example:
92 > +# @CODE
93 > +# PYTHON_REQ_USE="gdbm,ncurses(-)?"
94 > +# @CODE
95 > +#
96 > +# It will cause the Python dependencies to look like:
97 > +# @CODE
98 > +# python_single_target_pythonX_Y? ( dev-lang/python:X.Y[gdbm,ncurses(-)?] )
99 > +# @CODE
100 > +
101 > +# @ECLASS-VARIABLE: PYTHON_DEPS
102 > +# @DESCRIPTION:
103 > +# This is an eclass-generated Python dependency string for all
104 > +# implementations listed in PYTHON_COMPAT.
105 > +#
106 > +# The dependency string is conditional on PYTHON_SINGLE_TARGET.
107 > +#
108 > +# Example use:
109 > +# @CODE
110 > +# RDEPEND="${PYTHON_DEPS}
111 > +# dev-foo/mydep"
112 > +# DEPEND="${RDEPEND}"
113 > +# @CODE
114 > +#
115 > +# Example value:
116 > +# @CODE
117 > +# dev-python/python-exec
118 > +# python_single_target_python2_6? ( dev-lang/python:2.6[gdbm] )
119 > +# python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
120 > +# @CODE
121 > +
122 > +# @ECLASS-VARIABLE: PYTHON_USEDEP
123 > +# @DESCRIPTION:
124 > +# This is an eclass-generated USE-dependency string which can be used to
125 > +# depend on another Python package being built for the same Python
126 > +# implementations.
127 > +#
128 > +# The generate USE-flag list is compatible with packages using python-r1,
129 > +# python-single-r1 and python-distutils-ng eclasses. It must not be used
130 > +# on packages using python.eclass.
131 > +#
132 > +# Example use:
133 > +# @CODE
134 > +# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
135 > +# @CODE
136 > +#
137 > +# Example value:
138 > +# @CODE
139 > +# python_targets_python2_7?,python_single_target_python2_7(+)?
140 > +# @CODE
141 > +
142 > _python_single_set_globals() {
143 > + local flags_mt=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
144 > local flags=( "${PYTHON_COMPAT[@]/#/python_single_target_}" )
145 > - local optflags=${flags[@]/%/(+)?}
146 > + local optflags=${flags_mt[@]/%/?}
147 > + optflags+=,${flags[@]/%/(+)?}
148 >
149 > - IUSE=${flags[*]}
150 > - REQUIRED_USE="^^ ( ${flags[*]} )"
151 > - PYTHON_USEDEP+=,${optflags// /,}
152 > + IUSE="${flags_mt[*]} ${flags[*]}"
153 > + REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
154 > + PYTHON_USEDEP=${optflags// /,}
155 >
156 > local usestr
157 > [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
158 > @@ -88,6 +165,10 @@ _python_single_set_globals() {
159 > }
160 > _python_single_set_globals
161 >
162 > +# @FUNCTION: python-single-r1_pkg_setup
163 > +# @DESCRIPTION:
164 > +# Determine what the selected Python implementation is and set EPYTHON
165 > +# and PYTHON accordingly.
166 > python-single-r1_pkg_setup() {
167 > debug-print-function ${FUNCNAME} "${@}"
168 >
169 > @@ -101,20 +182,3 @@ python-single-r1_pkg_setup() {
170 > fi
171 > done
172 > }
173 > -
174 > -# Incompatible python-r1 functions.
175 > -
176 > -python_copy_sources() {
177 > - die "${FUNCNAME} must not be used with python-single-r1 eclass."
178 > -}
179 > -
180 > -python_foreach_impl() {
181 > - die "${FUNCNAME} must not be used with python-single-r1 eclass."
182 > -}
183 > -
184 > -python_export_best() {
185 > - die "${FUNCNAME} must not be used with python-single-r1 eclass."
186 > -}
187 > -
188 > -_PYTHON_SINGLE_R1=1
189 > -fi
190 > diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
191 > index d8e4b81..113e977 100644
192 > --- a/gx86/eclass/python-utils-r1.eclass
193 > +++ b/gx86/eclass/python-utils-r1.eclass
194 > @@ -40,6 +40,17 @@ if [[ ! ${_PYTHON_UTILS_R1} ]]; then
195 >
196 > inherit multilib
197 >
198 > +# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
199 > +# @INTERNAL
200 > +# @DESCRIPTION:
201 > +# All supported Python implementations, most preferred last.
202 > +_PYTHON_ALL_IMPLS=(
203 > + jython2_5
204 > + pypy1_8 pypy1_9
205 > + python3_1 python3_2 python3_3
206 > + python2_5 python2_6 python2_7
207 > +)
208 > +
209 > # @ECLASS-VARIABLE: PYTHON
210 > # @DESCRIPTION:
211 > # The absolute path to the current Python interpreter.
212 > --
213 > 1.8.0
214 >

Replies

Subject Author
Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone. "Michał Górny" <mgorny@g.o>