1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
<!DOCTYPE html>
<html lang="en" data-content_root="./">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>python-single-r1 — single-impl packages — Gentoo Python Guide documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d1102ebc" />
<link rel="stylesheet" type="text/css" href="_static/alabaster.css?v=12dfc556" />
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="python-r1 — multi-impl packages" href="multi.html" />
<link rel="prev" title="python-any-r1 — build-time dependency" href="any.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="python-single-r1-single-impl-packages">
<h1>python-single-r1 — single-impl packages<a class="headerlink" href="#python-single-r1-single-impl-packages" title="Link to this heading">¶</a></h1>
<p>The <code class="docutils literal notranslate"><span class="pre">python-single-r1</span></code> eclass is used to install single-impl packages.
It is probably the easiest eclass to use, and it is recommended over
<code class="docutils literal notranslate"><span class="pre">python-r1</span></code> whenever multi-impl support would add unnecessary
complexity. However, for packages using distutils or a similar Python
build system, <code class="docutils literal notranslate"><span class="pre">distutils-r1</span></code> eclass should be used instead.</p>
<p>Eclass reference: <a class="reference external" href="https://devmanual.gentoo.org/eclass-reference/python-single-r1.eclass/index.html">python-single-r1.eclass(5)</a></p>
<section id="basic-use-for-unconditional-python">
<h2>Basic use for unconditional Python<a class="headerlink" href="#basic-use-for-unconditional-python" title="Link to this heading">¶</a></h2>
<p>The defining feature of this eclass is that it defines a <code class="docutils literal notranslate"><span class="pre">pkg_setup</span></code>
phase. It normally calls <code class="docutils literal notranslate"><span class="pre">python_setup</span></code> function in order
to determine the interpreter selected by user, and set the global
environment appropriately.</p>
<p>This means that a most trivial package using an autotools-compatible
build system along with unconditional dependency on Python could look
like the following:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1"># Copyright 1999-2020 Gentoo Authors</span>
<span class="w"> </span><span class="c1"># Distributed under the terms of the GNU General Public License v2</span>
<span class="w"> </span><span class="nv">EAPI</span><span class="o">=</span><span class="m">7</span>
<span class="hll"><span class="w"> </span><span class="nv">PYTHON_COMPAT</span><span class="o">=(</span><span class="w"> </span>python2_7<span class="w"> </span><span class="o">)</span>
</span><span class="hll"><span class="w"> </span>inherit<span class="w"> </span>python-single-r1
</span>
<span class="w"> </span><span class="nv">DESCRIPTION</span><span class="o">=</span><span class="s2">"Scripts to prepare and plot VOACAP propagation predictions"</span>
<span class="w"> </span><span class="nv">HOMEPAGE</span><span class="o">=</span><span class="s2">"https://www.qsl.net/h/hz1jw//pythonprop/"</span>
<span class="w"> </span><span class="nv">SRC_URI</span><span class="o">=</span><span class="s2">"mirror://sourceforge/</span><span class="si">${</span><span class="nv">PN</span><span class="si">}</span><span class="s2">/</span><span class="si">${</span><span class="nv">P</span><span class="si">}</span><span class="s2">.tar.gz"</span>
<span class="w"> </span><span class="nv">LICENSE</span><span class="o">=</span><span class="s2">"GPL-2+"</span>
<span class="w"> </span><span class="nv">SLOT</span><span class="o">=</span><span class="s2">"0"</span>
<span class="w"> </span><span class="nv">KEYWORDS</span><span class="o">=</span><span class="s2">"~amd64 ~x86"</span>
<span class="w"> </span><span class="nv">IUSE</span><span class="o">=</span><span class="s2">""</span>
<span class="hll"><span class="w"> </span><span class="nv">REQUIRED_USE</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2">"</span>
</span>
<span class="w"> </span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="hll"><span class="s2"> </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span>
</span><span class="s2"> ...</span>
<span class="s2"> "</span>
<span class="w"> </span><span class="nv">BDEPEND</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">RDEPEND</span><span class="si">}</span><span class="s2">"</span>
</pre></div>
</div>
<p>This ebuild demonstrates the absolute minimum working code. Only
the four highlighted lines are specific to Python eclasses, plus
the implicitly exported <code class="docutils literal notranslate"><span class="pre">pkg_setup</span></code> phase.</p>
</section>
<section id="dependencies">
<span id="index-2"></span><span id="index-1"></span><span id="index-0"></span><h2>Dependencies<a class="headerlink" href="#dependencies" title="Link to this heading">¶</a></h2>
<p>When depending on other Python packages, USE dependencies need to be
declared in order to ensure that the dependencies would be built against
the Python implementation used for the package. The exact dependency
string depends on whether the target package is single-impl
or multi-impl.</p>
<p>When depending on other single-impl packages, the eclass-defined
<code class="docutils literal notranslate"><span class="pre">${PYTHON_SINGLE_USEDEP}</span></code> variable can be used to inject the correct
USE dependency:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="s2"> ...</span>
<span class="s2"> dev-python/basemap[</span><span class="si">${</span><span class="nv">PYTHON_SINGLE_USEDEP</span><span class="si">}</span><span class="s2">]</span>
<span class="s2">"</span>
</pre></div>
</div>
<p>When depending on multi-impl packages, a more complex construct must
be used. The <code class="docutils literal notranslate"><span class="pre">python_gen_cond_dep</span></code> generator function is used
to copy the specified dependency template for all supported
implementations, and substitute <code class="docutils literal notranslate"><span class="pre">${PYTHON_USEDEP}</span></code> template inside
it:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="s2"> ...</span>
<span class="s2"> </span><span class="k">$(</span>python_gen_cond_dep<span class="w"> </span><span class="s1">'</span>
<span class="s1"> dev-python/matplotlib-python2[gtk2,${PYTHON_USEDEP}]</span>
<span class="s1"> '</span><span class="k">)</span>
<span class="s2">"</span>
</pre></div>
</div>
<p>Please note that in this context, <code class="docutils literal notranslate"><span class="pre">${...}</span></code> is used as a literal
template substitution key, so it must be escaped to prevent bash from
substituting it immediately. In the above example, single quotes
are used for this purpose. When other variables are used, double quotes
with explicit escapes have to be used:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="s2"> ...</span>
<span class="s2"> </span><span class="k">$(</span>python_gen_cond_dep<span class="w"> </span><span class="s2">"</span>
<span class="s2"> dev-python/wxpython:</span><span class="si">${</span><span class="nv">WX_GTK_VER</span><span class="si">}</span><span class="s2">[\${PYTHON_USEDEP}]</span>
<span class="s2"> "</span><span class="k">)</span><span class="s2">"</span>
</pre></div>
</div>
<p>As demonstrated above, the USE dependency string can be combined with
other USE dependencies. <code class="docutils literal notranslate"><span class="pre">PYTHON_SINGLE_USEDEP</span></code> can be used both
inside and outside <code class="docutils literal notranslate"><span class="pre">python_gen_cond_dep</span></code>, while <code class="docutils literal notranslate"><span class="pre">PYTHON_USEDEP</span></code> only
inside it.</p>
</section>
<section id="conditional-python-use">
<h2>Conditional Python use<a class="headerlink" href="#conditional-python-use" title="Link to this heading">¶</a></h2>
<p>The examples so far assumed that Python is used unconditionally.
If Python support is conditional to a USE flag, appropriate USE
conditionals need to be used in metadata variables, and <code class="docutils literal notranslate"><span class="pre">pkg_setup</span></code>
needs to be rewritten to call the default implementation conditionally:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1"># Copyright 1999-2020 Gentoo Authors</span>
<span class="w"> </span><span class="c1"># Distributed under the terms of the GNU General Public License v2</span>
<span class="w"> </span><span class="nv">EAPI</span><span class="o">=</span><span class="m">6</span>
<span class="w"> </span><span class="nv">PYTHON_COMPAT</span><span class="o">=(</span><span class="w"> </span>python2_7<span class="w"> </span><span class="o">)</span>
<span class="w"> </span>inherit<span class="w"> </span>python-single-r1
<span class="w"> </span><span class="nv">DESCRIPTION</span><span class="o">=</span><span class="s2">"Yet more Objects for (High Energy Physics) Data Analysis"</span>
<span class="w"> </span><span class="nv">HOMEPAGE</span><span class="o">=</span><span class="s2">"http://yoda.hepforge.org/"</span>
<span class="w"> </span><span class="nv">SRC_URI</span><span class="o">=</span><span class="s2">"http://www.hepforge.org/archive/</span><span class="si">${</span><span class="nv">PN</span><span class="si">}</span><span class="s2">/</span><span class="si">${</span><span class="nv">P</span><span class="si">}</span><span class="s2">.tar.bz2"</span>
<span class="w"> </span><span class="nv">LICENSE</span><span class="o">=</span><span class="s2">"GPL-2"</span>
<span class="w"> </span><span class="nv">SLOT</span><span class="o">=</span><span class="s2">"0/</span><span class="si">${</span><span class="nv">PV</span><span class="si">}</span><span class="s2">"</span>
<span class="w"> </span><span class="nv">KEYWORDS</span><span class="o">=</span><span class="s2">"~amd64 ~x86 ~amd64-linux ~x86-linux"</span>
<span class="hll"><span class="w"> </span><span class="nv">IUSE</span><span class="o">=</span><span class="s2">"python root"</span>
</span><span class="hll"><span class="w"> </span><span class="nv">REQUIRED_USE</span><span class="o">=</span><span class="s2">"python? ( </span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2"> )"</span>
</span>
<span class="w"> </span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="hll"><span class="s2"> python? ( </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2"> )</span>
</span><span class="hll"><span class="s2"> root? ( sci-physics/root:=[python=,</span><span class="si">${</span><span class="nv">PYTHON_SINGLE_USEDEP</span><span class="si">}</span><span class="s2">] )"</span>
</span><span class="w"> </span><span class="nv">DEPEND</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">RDEPEND</span><span class="si">}</span>
<span class="hll"><span class="s2"> python? (</span>
</span><span class="hll"><span class="s2"> </span><span class="k">$(</span>python_gen_cond_dep<span class="w"> </span><span class="s1">'</span>
</span><span class="hll"><span class="s1"> dev-python/cython[${PYTHON_USEDEP}]</span>
</span><span class="hll"><span class="s1"> '</span><span class="k">)</span>
</span><span class="hll"><span class="s2"> )"</span>
</span>
<span class="w"> </span>pkg_setup<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="hll"><span class="w"> </span>use<span class="w"> </span>python<span class="w"> </span><span class="o">&&</span><span class="w"> </span>python-single-r1_pkg_setup
</span><span class="w"> </span><span class="o">}</span>
<span class="w"> </span>src_configure<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w"> </span>econf<span class="w"> </span><span class="se">\</span>
<span class="hll"><span class="w"> </span><span class="k">$(</span>use_enable<span class="w"> </span>python<span class="w"> </span>pyext<span class="k">)</span><span class="w"> </span><span class="se">\</span>
</span><span class="w"> </span><span class="k">$(</span>use_enable<span class="w"> </span>root<span class="k">)</span>
<span class="w"> </span><span class="o">}</span>
</pre></div>
</div>
</section>
<section id="a-hybrid-build-time-conditional-runtime">
<h2>A hybrid: build-time + conditional runtime<a class="headerlink" href="#a-hybrid-build-time-conditional-runtime" title="Link to this heading">¶</a></h2>
<p>A fairly common pattern is for Python to be required unconditionally
at build time but only conditionally at runtime. This happens e.g. when
the package is calling some helper scripts at build time, and optionally
installing Python bindings. In this case, the build time dependency
is expressed unconditionally, and the runtime dependency is made
USE-conditional:</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1"># Copyright 1999-2020 Gentoo Authors</span>
<span class="w"> </span><span class="c1"># Distributed under the terms of the GNU General Public License v2</span>
<span class="w"> </span><span class="nv">EAPI</span><span class="o">=</span><span class="m">6</span>
<span class="w"> </span><span class="nv">PYTHON_COMPAT</span><span class="o">=(</span><span class="w"> </span>python3_<span class="o">{</span><span class="m">6</span>,7,8<span class="o">}</span><span class="w"> </span><span class="o">)</span>
<span class="w"> </span><span class="nv">PYTHON_REQ_USE</span><span class="o">=</span><span class="s2">"threads(+)"</span>
<span class="w"> </span>inherit<span class="w"> </span>waf-utils<span class="w"> </span>python-single-r1
<span class="w"> </span><span class="nv">DESCRIPTION</span><span class="o">=</span><span class="s2">"Samba talloc library"</span>
<span class="w"> </span><span class="nv">HOMEPAGE</span><span class="o">=</span><span class="s2">"https://talloc.samba.org/"</span>
<span class="w"> </span><span class="nv">SRC_URI</span><span class="o">=</span><span class="s2">"https://www.samba.org/ftp/</span><span class="si">${</span><span class="nv">PN</span><span class="si">}</span><span class="s2">/</span><span class="si">${</span><span class="nv">P</span><span class="si">}</span><span class="s2">.tar.gz"</span>
<span class="w"> </span><span class="nv">LICENSE</span><span class="o">=</span><span class="s2">"GPL-3 LGPL-3+ LGPL-2"</span>
<span class="w"> </span><span class="nv">SLOT</span><span class="o">=</span><span class="s2">"0"</span>
<span class="w"> </span><span class="nv">KEYWORDS</span><span class="o">=</span><span class="s2">"~alpha amd64 arm ~arm64 ~hppa ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sh ~sparc x86 ~amd64-linux ~x86-linux ~x64-macos ~sparc-solaris ~x64-solaris"</span>
<span class="hll"><span class="w"> </span><span class="nv">IUSE</span><span class="o">=</span><span class="s2">"+python"</span>
</span><span class="hll"><span class="w"> </span><span class="nv">REQUIRED_USE</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2">"</span>
</span>
<span class="w"> </span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="s2"> ...</span>
<span class="hll"><span class="s2"> python? ( </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2"> )"</span>
</span><span class="w"> </span><span class="nv">DEPEND</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">RDEPEND</span><span class="si">}</span>
<span class="s2"> ...</span>
<span class="hll"><span class="s2"> </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2">"</span>
</span>
<span class="w"> </span><span class="nv">WAF_BINARY</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">S</span><span class="si">}</span><span class="s2">/buildtools/bin/waf"</span>
<span class="w"> </span>src_configure<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w"> </span><span class="nb">local</span><span class="w"> </span><span class="nv">extra_opts</span><span class="o">=(</span>
<span class="hll"><span class="w"> </span><span class="k">$(</span>usex<span class="w"> </span>python<span class="w"> </span><span class="s1">''</span><span class="w"> </span>--disable-python<span class="k">)</span>
</span><span class="w"> </span><span class="o">)</span>
<span class="w"> </span>waf-utils_src_configure<span class="w"> </span><span class="s2">"</span><span class="si">${</span><span class="nv">extra_opts</span><span class="p">[@]</span><span class="si">}</span><span class="s2">"</span>
<span class="w"> </span><span class="o">}</span>
</pre></div>
</div>
<p>Note that eclass-exported <code class="docutils literal notranslate"><span class="pre">pkg_setup</span></code> is used unconditionally here.</p>
</section>
<section id="multiple-use-conditions">
<h2>Multiple USE conditions<a class="headerlink" href="#multiple-use-conditions" title="Link to this heading">¶</a></h2>
<p>Finally, let’s give an example of a package where Python is needed
for two independent conditions. To make it more complex, one of them
applies to build time (tests) while the other to runtime (bindings).</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1"># Copyright 1999-2020 Gentoo Authors</span>
<span class="w"> </span><span class="c1"># Distributed under the terms of the GNU General Public License v2</span>
<span class="w"> </span><span class="nv">EAPI</span><span class="o">=</span><span class="m">7</span>
<span class="w"> </span><span class="nv">PYTHON_COMPAT</span><span class="o">=(</span><span class="w"> </span>python3_<span class="o">{</span><span class="m">6</span>,7,8<span class="o">}</span><span class="w"> </span><span class="o">)</span>
<span class="w"> </span>inherit<span class="w"> </span>cmake<span class="w"> </span>python-single-r1
<span class="w"> </span><span class="nv">DESCRIPTION</span><span class="o">=</span><span class="s2">"Sound design and signal processing system for composition and performance"</span>
<span class="w"> </span><span class="nv">HOMEPAGE</span><span class="o">=</span><span class="s2">"https://csound.github.io/"</span>
<span class="w"> </span><span class="nv">SRC_URI</span><span class="o">=</span><span class="s2">"https://dev.gentoo.org/~fordfrog/distfiles/</span><span class="si">${</span><span class="nv">P</span><span class="si">}</span><span class="s2">-distributable.tar.xz"</span>
<span class="w"> </span><span class="nv">LICENSE</span><span class="o">=</span><span class="s2">"LGPL-2.1 doc? ( FDL-1.2+ )"</span>
<span class="w"> </span><span class="nv">SLOT</span><span class="o">=</span><span class="s2">"0"</span>
<span class="w"> </span><span class="nv">KEYWORDS</span><span class="o">=</span><span class="s2">"~amd64 ~x86"</span>
<span class="hll"><span class="w"> </span><span class="nv">IUSE</span><span class="o">=</span><span class="s2">"python test"</span>
</span><span class="w"> </span><span class="nv">RESTRICT</span><span class="o">=</span><span class="s2">"!test? ( test )"</span>
<span class="w"> </span><span class="nv">REQUIRED_USE</span><span class="o">=</span><span class="s2">"</span>
<span class="hll"><span class="s2"> python? ( </span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2"> )</span>
</span><span class="hll"><span class="s2"> test? ( </span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2"> )"</span>
</span>
<span class="w"> </span><span class="nv">BDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="s2"> python? ( dev-lang/swig )</span>
<span class="hll"><span class="s2"> test? ( </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2"> )</span>
</span><span class="s2"> "</span>
<span class="w"> </span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span>
<span class="hll"><span class="s2"> python? ( </span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2"> )</span>
</span><span class="s2"> "</span>
<span class="w"> </span>pkg_setup<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="hll"><span class="w"> </span><span class="k">if</span><span class="w"> </span>use<span class="w"> </span>python<span class="w"> </span><span class="o">||</span><span class="w"> </span>use<span class="w"> </span><span class="nb">test</span><span class="w"> </span><span class="p">;</span><span class="w"> </span><span class="k">then</span>
</span><span class="hll"><span class="w"> </span>python-single-r1_pkg_setup
</span><span class="hll"><span class="w"> </span><span class="k">fi</span>
</span><span class="w"> </span><span class="o">}</span>
<span class="w"> </span>src_configure<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="w"> </span><span class="nb">local</span><span class="w"> </span><span class="nv">mycmakeargs</span><span class="o">=(</span>
<span class="hll"><span class="w"> </span>-DBUILD_PYTHON_INTERFACE<span class="o">=</span><span class="k">$(</span>usex<span class="w"> </span>python<span class="k">)</span>
</span><span class="hll"><span class="w"> </span>-DBUILD_PYTHON_OPCODES<span class="o">=</span><span class="k">$(</span>usex<span class="w"> </span>python<span class="k">)</span>
</span><span class="w"> </span><span class="o">)</span>
<span class="w"> </span>cmake_src_configure
<span class="w"> </span><span class="o">}</span>
</pre></div>
</div>
<p>Please note that in general, the condition in <code class="docutils literal notranslate"><span class="pre">pkg_setup</span></code> must match
the one in <code class="docutils literal notranslate"><span class="pre">REQUIRED_USE</span></code>, and that one is a superset of conditions
used in dependencies.</p>
</section>
<section id="manual-install">
<h2>Manual install<a class="headerlink" href="#manual-install" title="Link to this heading">¶</a></h2>
<p>Some packages do not include Python files in their build systems,
or do not install all of them. In this case, the necessary files
can be installed via one of the installation helpers.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="w"> </span><span class="c1"># Copyright 1999-2020 Gentoo Authors</span>
<span class="w"> </span><span class="c1"># Distributed under the terms of the GNU General Public License v2</span>
<span class="w"> </span><span class="nv">EAPI</span><span class="o">=</span><span class="m">6</span>
<span class="w"> </span><span class="nv">PYTHON_COMPAT</span><span class="o">=(</span><span class="w"> </span>python2_7<span class="w"> </span><span class="o">)</span>
<span class="w"> </span>inherit<span class="w"> </span>python-single-r1
<span class="w"> </span><span class="nv">DESCRIPTION</span><span class="o">=</span><span class="s2">"Arabic dictionary based on the DICT protocol"</span>
<span class="w"> </span><span class="nv">HOMEPAGE</span><span class="o">=</span><span class="s2">"https://www.arabeyes.org/Duali"</span>
<span class="w"> </span><span class="nv">SRC_URI</span><span class="o">=</span><span class="s2">"mirror://sourceforge/arabeyes/</span><span class="si">${</span><span class="nv">P</span><span class="si">}</span><span class="s2">.tar.bz2"</span>
<span class="w"> </span><span class="nv">LICENSE</span><span class="o">=</span><span class="s2">"BSD"</span>
<span class="w"> </span><span class="nv">SLOT</span><span class="o">=</span><span class="s2">"0"</span>
<span class="w"> </span><span class="nv">KEYWORDS</span><span class="o">=</span><span class="s2">"~alpha amd64 ~hppa ~ia64 ~mips ~ppc ~sparc x86"</span>
<span class="w"> </span><span class="nv">IUSE</span><span class="o">=</span><span class="s2">""</span>
<span class="w"> </span><span class="nv">REQUIRED_USE</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">PYTHON_REQUIRED_USE</span><span class="si">}</span><span class="s2">"</span>
<span class="w"> </span><span class="nv">DEPEND</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">PYTHON_DEPS</span><span class="si">}</span><span class="s2">"</span>
<span class="w"> </span><span class="nv">RDEPEND</span><span class="o">=</span><span class="s2">"</span><span class="si">${</span><span class="nv">DEPEND</span><span class="si">}</span><span class="s2">"</span>
<span class="w"> </span>src_install<span class="o">()</span><span class="w"> </span><span class="o">{</span>
<span class="hll"><span class="w"> </span>python_domodule<span class="w"> </span>pyduali
</span><span class="hll"><span class="w"> </span>python_doscript<span class="w"> </span>duali<span class="w"> </span>dict2db<span class="w"> </span>trans2arabic<span class="w"> </span>arabic2trans
</span><span class="w"> </span><span class="o">}</span>
</pre></div>
</div>
</section>
</section>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">Gentoo Python Guide</a></h1>
<h3>Navigation</h3>
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="preface.html">Preface</a></li>
<li class="toctree-l1"><a class="reference internal" href="interpreter.html">Python interpreters</a></li>
<li class="toctree-l1"><a class="reference internal" href="eclass.html">Choosing between Python eclasses</a></li>
<li class="toctree-l1"><a class="reference internal" href="basic.html">Common basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="any.html">python-any-r1 — build-time dependency</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">python-single-r1 — single-impl packages</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#basic-use-for-unconditional-python">Basic use for unconditional Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="#dependencies">Dependencies</a></li>
<li class="toctree-l2"><a class="reference internal" href="#conditional-python-use">Conditional Python use</a></li>
<li class="toctree-l2"><a class="reference internal" href="#a-hybrid-build-time-conditional-runtime">A hybrid: build-time + conditional runtime</a></li>
<li class="toctree-l2"><a class="reference internal" href="#multiple-use-conditions">Multiple USE conditions</a></li>
<li class="toctree-l2"><a class="reference internal" href="#manual-install">Manual install</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="multi.html">python-r1 — multi-impl packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="distutils.html">distutils-r1 — standard Python build systems</a></li>
<li class="toctree-l1"><a class="reference internal" href="test.html">Tests in Python packages</a></li>
<li class="toctree-l1"><a class="reference internal" href="distutils-legacy.html">distutils-r1 legacy concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="pypi.html">pypi — helper eclass for PyPI archives</a></li>
<li class="toctree-l1"><a class="reference internal" href="helper.html">Common helper functions</a></li>
<li class="toctree-l1"><a class="reference internal" href="depend.html">Advanced dependencies</a></li>
<li class="toctree-l1"><a class="reference internal" href="pytest.html">pytest recipes</a></li>
<li class="toctree-l1"><a class="reference internal" href="concept.html">Advanced concepts</a></li>
<li class="toctree-l1"><a class="reference internal" href="expert-multi.html">Expert python-r1 usage</a></li>
<li class="toctree-l1"><a class="reference internal" href="buildsys.html">Integration with build systems written in Python</a></li>
<li class="toctree-l1"><a class="reference internal" href="porting.html">Porting tips</a></li>
<li class="toctree-l1"><a class="reference internal" href="migration.html">Migration guides</a></li>
<li class="toctree-l1"><a class="reference internal" href="qawarn.html">QA checks and warnings</a></li>
<li class="toctree-l1"><a class="reference internal" href="package-maintenance.html">Python package maintenance</a></li>
<li class="toctree-l1"><a class="reference internal" href="interpreter-maintenance.html">Maintenance of Python implementations</a></li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="any.html" title="previous chapter">python-any-r1 — build-time dependency</a></li>
<li>Next: <a href="multi.html" title="next chapter">python-r1 — multi-impl packages</a></li>
</ul></li>
</ul>
</div>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©2020, Michał Górny, license: CC BY 4.0.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 7.4.7</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="_sources/single.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|