source: general/prog/python3.xml@ 55af6ce

lazarus trunk
Last change on this file since 55af6ce was 5895a37, checked in by Bruce Dubbs <bdubbs@…>, 7 weeks ago

Update blfs bootscripts version and fix an md5sum.

  • Property mode set to 100644
File size: 14.1 KB
RevLine 
[ab4fdfc]1<?xml version="1.0" encoding="UTF-8"?>
[6732c094]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[52d29f7]4 <!ENTITY % general-entities SYSTEM "../../general.ent">
5 %general-entities;
6
[2cee003]7 <!ENTITY python3-download-http
[3f89ec5]8 "https://www.python.org/ftp/python/&python3-version;/Python-&python3-version;.tar.xz">
[355495ce]9 <!ENTITY python3-download-ftp " ">
[ba6e7d32]10 <!ENTITY python3-md5sum "8defb33f0c37aa4bdd3a38ba52abde4e">
[7420ff72]11 <!ENTITY python3-size "20 MB">
[ba6e7d32]12 <!ENTITY python3-buildsize "335 MB (add 57 MB for tests)">
13 <!ENTITY python3-time "2.2 SBU (add 1.0 SBU for tests; both using parallelism=4)">
[e882fc37]14 <!--
[deaa200]15 Note: Size does not reflect docs that were installed in LFS.
[3df4c93]16 -->
[2cee003]17 <!ENTITY python3htmldoc-download-http
[1fe05eb]18 "https://www.python.org/ftp/python/doc/&python3-version;/python-&python3-version;-docs-html.tar.bz2">
[5895a37]19 <!ENTITY python3-docs-md5sum "6025ee63c0ded34aac874f5da8f1a90c" >
[52d29f7]20]>
21
[b88be39]22<sect1 id="python3" xreflabel="Python-&python3-version;">
23 <?dbhtml filename="python3.html" ?>
[83f69e5d]24
25
[b88be39]26 <title>Python-&python3-version;</title>
[83f69e5d]27
[b88be39]28 <indexterm zone="python3">
[03d30cf]29 <primary sortas="a-Python3">Python3</primary>
[83f69e5d]30 </indexterm>
31
32 <sect2 role="package">
[03d30cf]33 <title>Introduction to Python 3</title>
[83f69e5d]34
[355495ce]35 <para>
[03d30cf]36 The <application>Python 3</application> package contains the
[355495ce]37 <application>Python</application> development environment.
38 This is useful for object-oriented programming, writing scripts,
39 prototyping large programs or developing entire applications.
40 </para>
[48b816cb]41
[de33b2a]42 <note>
43 <para>
44 <application>Python 3</application> was installed in LFS.
45 The only reason to rebuild it here is if optional modules
[b9a6bcc0]46 are needed, or to upgrade this package.
[de33b2a]47 </para>
48 </note>
[60ddbaf]49
[5d0e7b8]50 &lfs121_checked;
[48b816cb]51
[bd68243]52 <important>
53 <para>
54 If upgrading to a new Python-3 minor version (for example,
[7420ff72]55 from Python-3.11.x to Python-3.12.0), you will need to reinstall
[bd68243]56 any Python3 modules you have installed. You should also
57 reinstall packages that generate Python3 modules
[54d58907]58 including
[c0bc0a9]59 &gobject-introspection;,
[8748122]60 <xref linkend="libxml2"/>,
[bd68243]61 <xref linkend="opencv"/>,
[26ca5bd0]62 <xref linkend="fontforge"/>,
63 <xref linkend="gnome-tweaks"/>,
64 <xref linkend="samba"/>, and
[bf09c25]65 <xref linkend="graphviz"/> (if swig is installed).
66 </para>
67
[fb0bbe2]68 <para>Before you upgrade, you can get a list of modules installed
69 with <command>pip3 list</command>. The list may be incomplete as
70 some Python modules are not installed with <command>pip3</command>,
71 for example the <literal>cracklib</literal> module installed by
72 <xref role='nodep' linkend='cracklib'/>. Use <command>ls
73 /usr/lib/python3.<replaceable>minor</replaceable>/site-packages</command>
74 for a comprehensive list.
[bd68243]75 </para>
[ec288f7]76
77 <para>
[fb0bbe2]78 The Python modules from LFS will also have to be reinstalled:
79 <ulink url="&lfs-root;/chapter08/flit-core.html">flit-core</ulink>,
[32c1b77]80 <ulink url="&lfs-root;/chapter08/wheel.html">wheel</ulink>,
[7420ff72]81 <ulink url="&lfs-root;/chapter08/setuptools.html">setuptools</ulink>,
[32c1b77]82 <ulink url="&lfs-root;/chapter08/meson.html">meson</ulink>,
83 <ulink url="&lfs-root;/chapter08/markupsafe.html">MarkupSafe</ulink>,
84 and <ulink url="&lfs-root;/chapter08/jinja2.html">Jinja2</ulink>.
[ec288f7]85 </para>
[bd68243]86 </important>
87
[83f69e5d]88 <bridgehead renderas="sect3">Package Information</bridgehead>
89 <itemizedlist spacing="compact">
90 <listitem>
[355495ce]91 <para>
92 Download (HTTP): <ulink url="&python3-download-http;"/>
93 </para>
[83f69e5d]94 </listitem>
95 <listitem>
[355495ce]96 <para>
97 Download (FTP): <ulink url="&python3-download-ftp;"/>
98 </para>
[83f69e5d]99 </listitem>
100 <listitem>
[355495ce]101 <para>
102 Download MD5 sum: &python3-md5sum;
103 </para>
[83f69e5d]104 </listitem>
105 <listitem>
[355495ce]106 <para>
107 Download size: &python3-size;
108 </para>
[83f69e5d]109 </listitem>
110 <listitem>
[355495ce]111 <para>
112 Estimated disk space required: &python3-buildsize;
113 </para>
[83f69e5d]114 </listitem>
115 <listitem>
[355495ce]116 <para>
117 Estimated build time: &python3-time;
118 </para>
[83f69e5d]119 </listitem>
120 </itemizedlist>
[e882fc37]121
[3df4c93]122 <bridgehead renderas="sect3">Additional Optional Download</bridgehead>
123 <itemizedlist spacing="compact">
124 <listitem>
125 <para>
126 Download (HTTP): <ulink url="&python3htmldoc-download-http;"/>
127 </para>
128 </listitem>
129 <listitem>
130 <para>
131 Download MD5 sum: &python3-docs-md5sum;
132 </para>
133 </listitem>
134 </itemizedlist>
135
[03d30cf]136 <bridgehead renderas="sect3">Python 3 Dependencies</bridgehead>
[e882fc37]137
[693f28e1]138 <bridgehead renderas="sect4">Recommended</bridgehead>
139 <para role="recommended">
[a82b5f44]140 <xref linkend="sqlite"/> (required if building firefox or thunderbird)
[693f28e1]141 </para>
142
[83f69e5d]143 <bridgehead renderas="sect4">Optional</bridgehead>
[355495ce]144 <para role="optional">
[7fe0ce3b]145 <xref linkend="bluez"/>,
[e882fc37]146 <xref linkend="gdb"/> (required for some tests),
147 <xref linkend="valgrind"/>, and
[4e207bb]148 <ulink url="https://www.bytereef.org/mpdecimal/">libmpdec</ulink>
[355495ce]149 </para>
150
151 <bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
152 <para role="optional">
[dcd5a063]153 <xref linkend="libnsl"/>,
154 <xref linkend="tk"/>, and
155 &berkeley-db;
[355495ce]156 </para>
[ce33273]157
[42ddc30]158 <para condition="html" role="usernotes">Editor Notes:
[355495ce]159 <ulink url="&blfs-wiki;/Python3"/>
160 </para>
[83f69e5d]161 </sect2>
162
163 <sect2 role="installation">
[03d30cf]164 <title>Installation of Python 3</title>
[83f69e5d]165
[355495ce]166 <para>
[03d30cf]167 Install <application>Python 3</application> by running the following
[355495ce]168 commands:
169 </para>
[83f69e5d]170
[a87fb41]171<screen><userinput>CXX="/usr/bin/g++" \
172./configure --prefix=/usr \
173 --enable-shared \
174 --with-system-expat \
175 --enable-optimizations &amp;&amp;
[83f69e5d]176make</userinput></screen>
177
[355495ce]178 <para>
[382d0115]179 <!-- I'm getting a test failure with empty $LANG:
180 "test test_curses failed"
181 "_curses.error: inswstr() returned ERR"
[7420ff72]182 not sure why, but let's just work around it with LC_ALL.
183
184 For Python-3.12.0 all tests pass with only LANG=en_US.utf8.
185 Total tests: run=41,505 skipped=1,199
186 Total test files: run=477/483 skipped=12 resource_denied=6
[61a04db5]187
[2c758f0]188 For Python-3.12.1 all tests pass
189 Total tests: run=40,624 skipped=1,136
190 Total test files: run=486/489 skipped=24 resource_denied=3
191
[5e551157]192 For Python-3.12.2 all tests pass
[b3156ddf]193 Total tests: run=41,580 skipped=1,144
194 Total test files: run=485/488 skipped=23 resource_denied=3
[ba6e7d32]195
196 For Python-3.12.3 all tests pass
197 Total tests: run=41,778 skipped=1,155
198 Total test files: run=485/488 skipped=24 resource_denied=3
[7420ff72]199 -->
[382d0115]200 To test the result, issue <command>LC_ALL=en_US.UTF-8
201 make test</command>.
[5e551157]202 Some tests may need an Internet connection.
[355495ce]203 </para>
204
205 <para>
206 Now, as the <systemitem class="username">root</systemitem> user:
207 </para>
208
[3df4c93]209<screen role="root"><userinput>make install</userinput></screen>
210
211 <para>
[1fe05eb]212 If upgrading and the documentation has been downloaded, optionally install
[3df4c93]213 it as the &root; user:
214 </para>
215
[4be7bcd]216<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python3-version;/html
217
218tar --strip-components=1 \
[3df4c93]219 --no-same-owner \
220 --no-same-permissions \
221 -C /usr/share/doc/python-&python3-version;/html \
222 -xvf ../python-&python3-version;-docs-html.tar.bz2</userinput></screen>
[1970f00]223
[879d269]224 </sect2>
225
226 <sect2 role="commands">
227 <title>Command Explanations</title>
228
[fd69a62]229 <para>
230 <command> CXX="/usr/bin/g++" ./configure ...</command>: Avoid an annoying
231 message during configuration.
232 </para>
233
[355495ce]234 <para>
[f1d7196]235 <parameter>--with-system-expat</parameter>: This switch enables linking
236 against the system version of <application>Expat</application>.
[355495ce]237 </para>
238
[988edbf5]239<!--
[fd69a62]240 <para>
[6e94284]241 <parameter>- -with-ensurepip=yes</parameter> : This switch enables building
[8558044]242 the <command>pip</command> and <command>setuptools</command> packaging
[229d069]243 programs. <command>setuptools</command> is needed for building some
244 Python modules.
[fd69a62]245 </para>
[988edbf5]246-->
[f1d7196]247 <para>
248 <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
[229d069]249 if you want to build the <application>Python</application> DBM Module
[f1d7196]250 against <application>Berkeley DB</application> instead of
251 <application>GDBM</application>.
252 </para>
253
[7c57f82]254 <para>
[a0bb9145]255 <parameter>--enable-optimizations</parameter>: This switch enables
[a87fb41]256 stable, but expensive, optimizations.
[7c57f82]257 </para>
258
259 <para>
260 <option>--with-lto</option>: This optional switch enables thick Link
261 Time Optimization. Unusually, it creates a much larger <filename
[4e207bb]262 class="libraryfile">/usr/lib/python&python3-majorver;/config-&python3-majorver;-&lt;arch&gt;-linux-gnu/libpython&python3-majorver;.a</filename>
[7c57f82]263 with a small increase in the time to compile
264 <application>Python</application>. Run-time results do not appear to show
265 any benefit from doing this.
266 </para>
[7224506]267
[879d269]268 </sect2>
269
270 <sect2 role="configuration">
[03d30cf]271 <title>Configuring Python 3</title>
[879d269]272
[355495ce]273 <para>
[03d30cf]274 In order for <command>python3</command> to find the installed
[d7015e7]275 documentation, create the following version independent symlink:
[355495ce]276 </para>
[1970f00]277
[d7015e7]278<screen role="root"><userinput>ln -svfn python-&python3-version; /usr/share/doc/python-3</userinput></screen>
279
280 <para>
281 and add the following environment variable to the individual user's or
282 system's profile:
283 </para>
284
285<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-3/html</userinput></screen>
[83f69e5d]286
287 </sect2>
288
289 <sect2 role="content">
290 <title>Contents</title>
291
292 <segmentedlist>
293 <segtitle>Installed Programs</segtitle>
294 <segtitle>Installed Libraries</segtitle>
295 <segtitle>Installed Directories</segtitle>
296
297 <seglistitem>
[355495ce]298 <seg>
[f2ff0e4]299 2to3 (symlink) and
[355495ce]300 2to3-&python3-majorver;,
301
[229d069]302 <!--
[f2ff0e4]303 easy_install-&python3-majorver;,
[229d069]304 -->
[f2ff0e4]305
306 idle3 (symlink) and
307 idle&python3-majorver;,
[f5c5306]308
[deaa200]309 pip3 and
[f2ff0e4]310 pip&python3-majorver;,
311
[deaa200]312 pydoc3 (symlink) and
[355495ce]313 pydoc&python3-majorver;,
314
[deaa200]315 python3 (symlink) and
[f2ff0e4]316 python&python3-majorver;, and
[355495ce]317
[f2ff0e4]318 python3-config (symlink) and
319 python&python3-majorver;-config
[355495ce]320 </seg>
321 <seg>
[9e91b25]322 libpython&python3-majorver;.so and libpython3.so
[355495ce]323 </seg>
324 <seg>
[9e91b25]325 /usr/include/python&python3-majorver;,
[355495ce]326 /usr/lib/python&python3-majorver;, and
327 /usr/share/doc/python-&python3-version;
328 </seg>
[83f69e5d]329 </seglistitem>
330 </segmentedlist>
331
332 <variablelist>
333 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
334 <?dbfo list-presentation="list"?>
335 <?dbhtml list-presentation="table"?>
[f2ff0e4]336 <!--
337 <varlistentry id="2to3">
338 <term><command>2to3</command></term>
339 <listitem>
340 <para>
341 is designed to assist in the transition between python2 and python3
342 by automatically converting code to be Python3 compatible.
343 </para>
344 <indexterm zone="python3 2to3">
345 <primary sortas="b-2to3">2to3</primary>
346 </indexterm>
347 </listitem>
348 </varlistentry>
349 Put here for easy use when removing Python2 -->
[229d069]350 <!--
[f2ff0e4]351 <varlistentry id="easy_install">
352 <term><command>easy_install</command></term>
353 <listitem>
354 <para>
355 is a frontend to pip3 to make it easier to configure python modules
[4c24eb0a]356 through the PIP package manager
[f2ff0e4]357 </para>
358 <indexterm zone="python3 easy_install">
359 <primary sortas="python3 easy_install">easy_install</primary>
360 </indexterm>
361 </listitem>
362 </varlistentry>
[229d069]363 -->
[355495ce]364 <varlistentry id="idle3">
365 <term><command>idle3</command></term>
[83f69e5d]366 <listitem>
[355495ce]367 <para>
[d0aecd33]368 is a wrapper script that opens a <application>Python</application>
369 aware GUI editor. For this script to run, you must have installed
370 <application>Tk</application> before Python so that the Tkinter
[4c24eb0a]371 Python module is built
[355495ce]372 </para>
373 <indexterm zone="python3 idle3">
374 <primary sortas="b-idle3">idle3</primary>
[83f69e5d]375 </indexterm>
376 </listitem>
377 </varlistentry>
378
[355495ce]379 <varlistentry id="pydoc3">
380 <term><command>pydoc3</command></term>
[83f69e5d]381 <listitem>
[355495ce]382 <para>
383 is the <application>Python</application> documentation
[4c24eb0a]384 tool
[355495ce]385 </para>
386 <indexterm zone="python3 pydoc3">
387 <primary sortas="b-pydoc3">pydo3c</primary>
[83f69e5d]388 </indexterm>
389 </listitem>
390 </varlistentry>
391
[b88be39]392 <varlistentry id="python3-prog">
[2cee003]393 <term><command>python3</command></term>
[83f69e5d]394 <listitem>
[355495ce]395 <para>
396 is an interpreted, interactive, object-oriented programming
[4c24eb0a]397 language
[355495ce]398 </para>
[b88be39]399 <indexterm zone="python3 python3-prog">
400 <primary sortas="b-python3">python3</primary>
[83f69e5d]401 </indexterm>
402 </listitem>
403 </varlistentry>
404
[f67f5387]405 <varlistentry id="python-ver">
[b88be39]406 <term><command>python&python3-majorver;</command></term>
[83f69e5d]407 <listitem>
[355495ce]408 <para>
409 is a version-specific name for the <command>python</command>
[4c24eb0a]410 program
[355495ce]411 </para>
[b88be39]412 <indexterm zone="python3 python-ver">
[4c24eb0a]413 <primary sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
[83f69e5d]414 </indexterm>
415 </listitem>
416 </varlistentry>
[f2ff0e4]417 <!--
[21e8edc]418 <varlistentry id="pyvenv">
419 <term><command>pyvenv</command></term>
420 <listitem>
421 <para>
422 creates virtual <application>Python</application> environments in
423 one or more target directories.
424 </para>
425 <indexterm zone="python3 pyvenv">
426 <primary
427 sortas="b-python&python3-majorver;">python&python3-majorver;</primary>
428 </indexterm>
429 </listitem>
430 </varlistentry>
[f2ff0e4]431 -->
[83f69e5d]432 </variablelist>
433
434 </sect2>
[f45b1953]435
436</sect1>
Note: See TracBrowser for help on using the repository browser.