Gentoo Archives: gentoo-commits

From: "Michal Gorny (mgorny)" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in xml/htdocs/proj/en/Python/python-r1: dev-guide.xml
Date: Tue, 27 Nov 2012 20:41:37
Message-Id: 20121127204125.12A2920C65@flycatcher.gentoo.org
1 mgorny 12/11/27 20:41:25
2
3 Modified: dev-guide.xml
4 Log:
5 Explain the active implementation setting.
6
7 Revision Changes Path
8 1.5 xml/htdocs/proj/en/Python/python-r1/dev-guide.xml
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml?rev=1.5&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml?rev=1.5&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml?r1=1.4&r2=1.5
13
14 Index: dev-guide.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml,v
17 retrieving revision 1.4
18 retrieving revision 1.5
19 diff -u -r1.4 -r1.5
20 --- dev-guide.xml 27 Nov 2012 17:47:42 -0000 1.4
21 +++ dev-guide.xml 27 Nov 2012 20:41:24 -0000 1.5
22 @@ -1,7 +1,7 @@
23 <?xml version="1.0" encoding="UTF-8"?>
24 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
25
26 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml,v 1.4 2012/11/27 17:47:42 mgorny Exp $ -->
27 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/proj/en/Python/python-r1/dev-guide.xml,v 1.5 2012/11/27 20:41:24 mgorny Exp $ -->
28
29 <guide lang="en">
30 <title>python-r1 Developer's Guide</title>
31 @@ -23,7 +23,7 @@
32 <!-- See http://creativecommons.org/licenses/by-sa/3.0/ -->
33 <license version="3.0"/>
34
35 -<version>4</version>
36 +<version>5</version>
37 <date>2012-11-27</date>
38
39 <chapter id="Introductory_info">
40 @@ -200,6 +200,116 @@
41 </note>
42 </body>
43 </section>
44 +
45 + <section id="ii_The_active_Python_interpreter_in_ebuild_scope">
46 + <title>The active Python interpreter in ebuild scope</title>
47 +
48 + <body>
49 + <p>
50 + A key concept in the workflow of python-r1 suite is the setting
51 + of the active Python interpreter. Its value is stored
52 + and exported in the <c>EPYTHON</c> environment variable.
53 + </p>
54 +
55 + <p>
56 + The setting of active Python interpreter can affect;
57 + </p>
58 +
59 + <ol>
60 + <li>
61 + the interpreter used to run external Python scripts,
62 + </li>
63 +
64 + <li>
65 + the implementation used by helpers,
66 + such as <c>python_domodule</c> and <c>python_doscript</c>,
67 + </li>
68 +
69 + <li>
70 + the default implementation for <c>python_export</c>
71 + and the associated getter functions.
72 + </li>
73 + </ol>
74 +
75 + <p>
76 + The <c>EPYTHON</c> variable is set implicitly in the following
77 + scopes;
78 + </p>
79 +
80 + <ol>
81 + <li>
82 + in commands and functions run by <c>python_foreach_impl</c>,
83 + </li>
84 +
85 + <li>
86 + in implementation-specific sub-phases of <c>distutils-r1</c>,
87 + </li>
88 +
89 + <li>
90 + in ebuilds using the <c>python-single-r1</c> eclass after
91 + running <c>python-single-r1_pkg_setup</c>.
92 + </li>
93 + </ol>
94 +
95 + <p>
96 + If it is otherwise necessary to set the active Python
97 + interpreter, it can be either set using the <c>python_export</c>
98 + function or by setting the <c>EPYTHON</c> variable directly.
99 + For the details on the former solution, please refer to the <uri
100 + link="#pur1_Obtaining_Python_implementation_information">Obtaining
101 + Python implementation information</uri> section.
102 + </p>
103 +
104 + <p>
105 + If <c>EPYTHON</c> is set directly, it needs to have one
106 + of the following values;
107 + </p>
108 +
109 + <ol>
110 + <li>
111 + <c>pythonX.Y</c> for CPython X.Y;
112 + </li>
113 +
114 + <li>
115 + <c>pypy-cX.Y</c> for PyPy X.Y;
116 + </li>
117 +
118 + <li>
119 + <c>jythonX.Y</c> for Jython X.Y.
120 + </li>
121 + </ol>
122 +
123 + <note>
124 + Please note that for <c>EPYTHON</c> to be effective to external
125 + programs, it needs to be exported.
126 + </note>
127 +
128 + <pre caption='Setting EPYTHON for the function scope'>
129 +pkg_setup() {
130 + <comment># Variant 1</comment>
131 + <comment># The variables are not local, therefore the setting is preserved</comment>
132 + <comment># through phase functions.</comment>
133 + <keyword>python_export</keyword> <ident>python2_7</ident>
134 +}
135 +
136 +src_compile() {
137 + <comment># Variant 2</comment>
138 + <comment># The variables are kept local.</comment>
139 + local <var>EPYTHON PYTHON</var>
140 + <keyword>python_export</keyword> <ident>python2_7</ident>
141 +
142 + <comment># …</comment>
143 +}
144 +
145 +src_install() {
146 + <comment># Variant 3</comment>
147 + local <var>EPYTHON</var>=<ident>python2.7</ident>
148 +
149 + <comment># …</comment>
150 +}
151 +</pre>
152 + </body>
153 + </section>
154 </chapter>
155
156 <chapter id="The_fundamentals_of_python_r1_eclass">
157 @@ -712,12 +822,11 @@
158 </p>
159
160 <p>
161 - The <c>python_export</c> can additionally take a Python
162 + The <c>python_export</c> function can additionally take a Python
163 implementation as a first argument, either in the form of a USE
164 flag or an <c>EPYTHON</c> value. If such a form is used,
165 the values specific to the passed implementation are exported.
166 - Otherwise, the currently used implementation (the <c>EPYTHON</c>
167 - environment variable) is used.
168 + Otherwise, the currently active implementation is used.
169 </p>
170
171 <p>
172 @@ -827,9 +936,9 @@
173 </p>
174
175 <p>
176 - The installed modules will be byte-compiled using the current
177 - Python implementation. The selected implementation determines
178 - the <c>site-packages</c> location as well.
179 + The installed modules will be byte-compiled using the currently
180 + active Python implementation. The selected implementation
181 + determines the <c>site-packages</c> location as well.
182 </p>
183
184 <pre caption='Installing Python modules and packages'>
185 @@ -866,8 +975,9 @@
186
187 <p>
188 The installed scripts will be renamed to end
189 - with an implementation-specific suffix. A wrapper will be linked
190 - in place of the original name.
191 + with an implementation-specific suffix specific to the currently
192 + active Python interpreter. A wrapper will be linked in place
193 + of the original name.
194 </p>
195
196 <pre caption='Installing Python scripts'>
197 @@ -913,8 +1023,8 @@
198 </p>
199
200 <p>
201 - The modules are compiled using the current Python implementation
202 - (<c>EPYTHON</c>).
203 + The modules are compiled using the currently active Python
204 + implementation.
205 </p>
206
207 <pre caption='Compiling Python modules'>