[bf847d6d] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 |
|
---|
[181662f] | 7 | <!ENTITY python2-download-http
|
---|
[549e65f] | 8 | "https://www.python.org/ftp/python/&python2-version;/Python-&python2-version;.tar.xz">
|
---|
[27d9434] | 9 | <!ENTITY python2-download-ftp " ">
|
---|
[fdf7cce1] | 10 | <!ENTITY python2-md5sum "fd6cc8ec0a78c44036f825e739f36e5a">
|
---|
| 11 | <!ENTITY python2-size "12.2 MB">
|
---|
[292ff45] | 12 | <!ENTITY python2-buildsize "228 MB (add 17 MB for tests)">
|
---|
| 13 | <!ENTITY python2-time "0.5 SBU (Using parallelism=4; add 5.9 SBU for tests)">
|
---|
[82fac2c] | 14 |
|
---|
[181662f] | 15 | <!ENTITY python2htmldoc-download-http
|
---|
[cf6ee3d9] | 16 | "https://www.python.org/ftp/python/doc/&python2-version;/python-&python2-version;-docs-html.tar.bz2">
|
---|
[bf847d6d] | 17 | ]>
|
---|
| 18 |
|
---|
[4716d52] | 19 | <sect1 id="python2" xreflabel="Python-&python2-version;">
|
---|
[bf847d6d] | 20 | <?dbhtml filename="python2.html" ?>
|
---|
| 21 |
|
---|
| 22 | <sect1info>
|
---|
[4949485e] | 23 | <date>$Date$</date>
|
---|
[bf847d6d] | 24 | </sect1info>
|
---|
| 25 |
|
---|
| 26 | <title>Python-&python2-version;</title>
|
---|
| 27 |
|
---|
[4716d52] | 28 | <indexterm zone="python2">
|
---|
[82fac2c] | 29 | <primary sortas="a-Python2">Python2</primary>
|
---|
[bf847d6d] | 30 | </indexterm>
|
---|
| 31 |
|
---|
| 32 | <sect2 role="package">
|
---|
| 33 | <title>Introduction to Python 2</title>
|
---|
| 34 |
|
---|
[181662f] | 35 | <para>
|
---|
| 36 | The <application>Python 2</application> package contains the
|
---|
[82fac2c] | 37 | <application>Python</application> development environment. It is useful
|
---|
[181662f] | 38 | for object-oriented programming, writing scripts, prototyping large
|
---|
| 39 | programs or developing entire applications. This version is for backward
|
---|
| 40 | compatibility with other dependent packages.
|
---|
| 41 | </para>
|
---|
[bf847d6d] | 42 |
|
---|
[4343801] | 43 | <note>
|
---|
| 44 | <para>
|
---|
[8558044] | 45 | Python2 has been deprecated by the upstream developers.
|
---|
| 46 | Support for Python2 was discontinued on January 1st, 2020.
|
---|
[4343801] | 47 | </para>
|
---|
[8558044] | 48 |
|
---|
[de33b2a] | 49 | <para>
|
---|
[4343801] | 50 | BLFS is attempting to use Python3 as much as possible, but some
|
---|
| 51 | packages have not been updated to support Python3.
|
---|
| 52 | </para>
|
---|
| 53 | </note>
|
---|
| 54 |
|
---|
[046d740] | 55 | &lfs112_checked;
|
---|
[bf847d6d] | 56 |
|
---|
| 57 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 58 | <itemizedlist spacing="compact">
|
---|
| 59 | <listitem>
|
---|
[181662f] | 60 | <para>
|
---|
| 61 | Download (HTTP): <ulink url="&python2-download-http;"/>
|
---|
| 62 | </para>
|
---|
[bf847d6d] | 63 | </listitem>
|
---|
| 64 | <listitem>
|
---|
[181662f] | 65 | <para>
|
---|
| 66 | Download (FTP): <ulink url="&python2-download-ftp;"/>
|
---|
| 67 | </para>
|
---|
[bf847d6d] | 68 | </listitem>
|
---|
| 69 | <listitem>
|
---|
[181662f] | 70 | <para>
|
---|
| 71 | Download MD5 sum: &python2-md5sum;
|
---|
| 72 | </para>
|
---|
[bf847d6d] | 73 | </listitem>
|
---|
| 74 | <listitem>
|
---|
[181662f] | 75 | <para>
|
---|
| 76 | Download size: &python2-size;
|
---|
| 77 | </para>
|
---|
[bf847d6d] | 78 | </listitem>
|
---|
| 79 | <listitem>
|
---|
[181662f] | 80 | <para>
|
---|
| 81 | Estimated disk space required: &python2-buildsize;
|
---|
| 82 | </para>
|
---|
[bf847d6d] | 83 | </listitem>
|
---|
| 84 | <listitem>
|
---|
[181662f] | 85 | <para>
|
---|
| 86 | Estimated build time: &python2-time;
|
---|
| 87 | </para>
|
---|
[bf847d6d] | 88 | </listitem>
|
---|
| 89 | </itemizedlist>
|
---|
| 90 |
|
---|
[54ae6b8] | 91 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 92 |
|
---|
[5d11f8f] | 93 | <itemizedlist spacing="compact">
|
---|
[bf847d6d] | 94 | <listitem>
|
---|
[181662f] | 95 | <para>
|
---|
[292ff45] | 96 | Required patch:
|
---|
| 97 | <ulink url="&patch-root;/Python-&python2-version;-security_fixes-1.patch"/>
|
---|
| 98 | </para>
|
---|
| 99 | </listitem>
|
---|
| 100 | <listitem>
|
---|
| 101 | <para>
|
---|
| 102 | Optional HTML Documentation: <ulink url="&python2htmldoc-download-http;"/>
|
---|
[181662f] | 103 | </para>
|
---|
[bf847d6d] | 104 | </listitem>
|
---|
[fb990982] | 105 | </itemizedlist>
|
---|
| 106 |
|
---|
[292ff45] | 107 |
|
---|
[03d30cf] | 108 | <bridgehead renderas="sect3">Python 2 Dependencies</bridgehead>
|
---|
[db8d276] | 109 |
|
---|
[82fac2c] | 110 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 111 | <para role="recommended">
|
---|
[db8d276] | 112 | <xref linkend="sqlite"/> (For an additional modules)
|
---|
[82fac2c] | 113 | </para>
|
---|
[db8d276] | 114 |
|
---|
[bf847d6d] | 115 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[181662f] | 116 | <para role="optional">
|
---|
[9be7202] | 117 | <xref linkend="bluez"/> and
|
---|
| 118 | <xref linkend="valgrind"/>
|
---|
[82fac2c] | 119 | </para>
|
---|
| 120 |
|
---|
[db8d276] | 121 | <bridgehead renderas="sect4">Optional (For more additional modules)</bridgehead>
|
---|
[82fac2c] | 122 | <para role="optional">
|
---|
[db8d276] | 123 | <xref linkend="libnsl"/> and
|
---|
[82fac2c] | 124 | <xref linkend="tk"/>
|
---|
[181662f] | 125 | </para>
|
---|
[cac7f93] | 126 |
|
---|
[181662f] | 127 | <para condition="html" role="usernotes">
|
---|
| 128 | User Notes: <ulink url="&blfs-wiki;/Python"/>
|
---|
| 129 | </para>
|
---|
[bf847d6d] | 130 | </sect2>
|
---|
| 131 |
|
---|
| 132 | <sect2 role="installation">
|
---|
[03d30cf] | 133 | <title>Installation of Python 2</title>
|
---|
[61f684f2] | 134 | <!--
|
---|
[4343801] | 135 | <caution>
|
---|
| 136 | <para>
|
---|
[8558044] | 137 | After installing this package or
|
---|
[420d60b] | 138 | updating <application>pip2</application> with the command
|
---|
[61f684f2] | 139 | <command>pip2 install - -upgrade pip</command>, it will remove
|
---|
[8558044] | 140 | <application>pip3</application> installed in LFS. To reset
|
---|
[4343801] | 141 | <application>pip</application> and <application>pip3</application>,
|
---|
| 142 | run, as the <systemitem class="username">root</systemitem> user:
|
---|
| 143 | </para>
|
---|
| 144 |
|
---|
[61f684f2] | 145 | <screen role="nodump"><userinput>python3 -m pip install - -force pip</userinput></screen>
|
---|
[4343801] | 146 | </caution>
|
---|
[61f684f2] | 147 | -->
|
---|
| 148 | <para>
|
---|
[8558044] | 149 | First, disable the installation of a script that overwrites a more
|
---|
[61f684f2] | 150 | recent script:
|
---|
| 151 | </para>
|
---|
| 152 |
|
---|
| 153 | <screen><userinput>sed -i '/2to3/d' ./setup.py</userinput></screen>
|
---|
[4343801] | 154 |
|
---|
[181662f] | 155 | <para>
|
---|
[03d30cf] | 156 | Install <application>Python 2</application> by running the following
|
---|
[181662f] | 157 | commands:
|
---|
| 158 | </para>
|
---|
[bf847d6d] | 159 |
|
---|
[8d52465b] | 160 | <screen><userinput>patch -Np1 -i ../Python-&python2-version;-security_fixes-1.patch &&
|
---|
[292ff45] | 161 | ./configure --prefix=/usr \
|
---|
| 162 | --enable-shared \
|
---|
| 163 | --with-system-expat \
|
---|
| 164 | --with-system-ffi \
|
---|
| 165 | --enable-unicode=ucs4 &&
|
---|
[bf847d6d] | 166 | make</userinput></screen>
|
---|
| 167 |
|
---|
[167a240] | 168 | <para>
|
---|
[292ff45] | 169 | If you invoke the tests, they will run through twice.
|
---|
[1a64240] | 170 | To test the results, issue: <command>make -k test</command>.
|
---|
[5f26bc36] | 171 | <!-- https://bugs.python.org/issue46811 -->
|
---|
| 172 | Several tests are known to fail, including
|
---|
| 173 | <literal>test_ftplib</literal>,
|
---|
| 174 | <literal>test_ssl</literal>,
|
---|
| 175 | <literal>test_urllib2_localnet</literal>,
|
---|
[046d740] | 176 | <literal>test_xml_etree</literal>,
|
---|
| 177 | <literal>test_xml_etree_c</literal>, and
|
---|
[5f26bc36] | 178 | <literal>test_minidom</literal>. These failures are due to
|
---|
| 179 | OpenSSL-3 and Expat-2.4.6.
|
---|
[181662f] | 180 | </para>
|
---|
[bf847d6d] | 181 |
|
---|
[181662f] | 182 | <para>
|
---|
| 183 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 184 | </para>
|
---|
[bf847d6d] | 185 |
|
---|
[61f684f2] | 186 | <screen role="root"><userinput>make altinstall &&
|
---|
| 187 | ln -s python2.7 /usr/bin/python2 &&
|
---|
| 188 | ln -s python2.7-config /usr/bin/python2-config &&
|
---|
[7224506] | 189 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 190 |
|
---|
[181662f] | 191 | <para>
|
---|
[7fe0ce3b] | 192 | Since <application>Python 2</application> is in maintenance mode, and
|
---|
| 193 | <application>Python 3</application> is recommended by upstream for
|
---|
[8b9b43e] | 194 | development, you probably do not need to install the documentation.
|
---|
[7fe0ce3b] | 195 | However, if you still want to install documentation for both
|
---|
[8b9b43e] | 196 | <application>Python</application> versions, be sure to define the
|
---|
| 197 | <envar>PYTHONDOCS</envar>
|
---|
[7fe0ce3b] | 198 | variable for the version you want to use, each time you need to consult
|
---|
| 199 | the documentation. If you have downloaded the preformatted documentation
|
---|
| 200 | from <ulink url="http://docs.python.org/download.html"/>, install it
|
---|
[03d30cf] | 201 | as the <systemitem class="username">root</systemitem> user:
|
---|
[181662f] | 202 | </para>
|
---|
| 203 |
|
---|
[23d3543c] | 204 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &&
|
---|
[7b273030] | 205 |
|
---|
| 206 | tar --strip-components=1 \
|
---|
| 207 | --no-same-owner \
|
---|
| 208 | --directory /usr/share/doc/python-&python2-version; \
|
---|
| 209 | -xvf ../python-&python2-version;-docs-html.tar.bz2 &&
|
---|
| 210 |
|
---|
[03d30cf] | 211 | find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &&
|
---|
| 212 | find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
|
---|
[bf847d6d] | 213 | </sect2>
|
---|
| 214 |
|
---|
| 215 | <sect2 role="commands">
|
---|
| 216 | <title>Command Explanations</title>
|
---|
| 217 |
|
---|
[82fac2c] | 218 | <para>
|
---|
[00ff1df] | 219 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 220 | against system version of <application>Expat</application>.
|
---|
[82fac2c] | 221 | </para>
|
---|
| 222 |
|
---|
| 223 | <para>
|
---|
[00ff1df] | 224 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[8558044] | 225 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 226 | </para>
|
---|
| 227 |
|
---|
[23c5563] | 228 | <para>
|
---|
[9c76376] | 229 | <parameter>--enable-unicode=ucs4</parameter>: This switch enables
|
---|
[b9c353b] | 230 | 32-bit Unicode support in <application>Python</application>.
|
---|
[23c5563] | 231 | </para>
|
---|
| 232 |
|
---|
[82fac2c] | 233 | <para>
|
---|
[9c76376] | 234 | <option>--with-ensurepip=yes</option> : This switch enables building
|
---|
| 235 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 236 | <command>setuptools</command> is needed for building some Python modules.
|
---|
| 237 | This switch is not recommended because this version of Python is being phased out.
|
---|
[82fac2c] | 238 | </para>
|
---|
| 239 |
|
---|
| 240 | <para>
|
---|
[00ff1df] | 241 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[0d7900a] | 242 | if you want to build <application>Python</application> DBM Module
|
---|
[82fac2c] | 243 | against <application>Berkeley DB</application> instead of
|
---|
| 244 | <application>GDBM</application>.
|
---|
| 245 | </para>
|
---|
| 246 |
|
---|
[61f684f2] | 247 | <para>
|
---|
[8558044] | 248 | <command>make altinstall</command>: This make target omits some default
|
---|
[61f684f2] | 249 | symbolic links that may interfere with Python 3.
|
---|
| 250 | </para>
|
---|
| 251 |
|
---|
[181662f] | 252 | <para>
|
---|
[0d7900a] | 253 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
[181662f] | 254 | consistent with other libraries.
|
---|
| 255 | </para>
|
---|
[82fac2c] | 256 |
|
---|
[bf847d6d] | 257 | </sect2>
|
---|
| 258 |
|
---|
| 259 | <sect2 role="configuration">
|
---|
| 260 | <title>Configuring Python 2</title>
|
---|
| 261 |
|
---|
[181662f] | 262 | <para>
|
---|
| 263 | In order for <command>python</command> to find the installed
|
---|
| 264 | documentation, you must add the following environment variable to
|
---|
| 265 | individual user's or the system's profile:
|
---|
| 266 | </para>
|
---|
[bf847d6d] | 267 |
|
---|
[03d30cf] | 268 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
[82fac2c] | 269 |
|
---|
[bf847d6d] | 270 | </sect2>
|
---|
| 271 |
|
---|
| 272 | <sect2 role="content">
|
---|
| 273 | <title>Contents</title>
|
---|
| 274 |
|
---|
| 275 | <segmentedlist>
|
---|
| 276 | <segtitle>Installed Programs</segtitle>
|
---|
[03d30cf] | 277 | <segtitle>Installed Library</segtitle>
|
---|
[bf847d6d] | 278 | <segtitle>Installed Directories</segtitle>
|
---|
| 279 |
|
---|
| 280 | <seglistitem>
|
---|
[181662f] | 281 | <seg>
|
---|
[8558044] | 282 | pydoc,
|
---|
| 283 | python2 (symlink),
|
---|
[61f684f2] | 284 | python2-config (symlink),
|
---|
[8558044] | 285 | python&python2-majorver;,
|
---|
[61f684f2] | 286 | python&python2-majorver;-config,
|
---|
[8558044] | 287 | smtpd.py, and
|
---|
[61f684f2] | 288 | idle
|
---|
[181662f] | 289 | </seg>
|
---|
| 290 | <seg>
|
---|
[03d30cf] | 291 | libpython&python2-majorver;.so
|
---|
[181662f] | 292 | </seg>
|
---|
| 293 | <seg>
|
---|
[fcabde3c] | 294 | /usr/{include,lib}/python&python2-majorver; and
|
---|
| 295 | /usr/share/doc/python-&python2-version;
|
---|
| 296 | </seg>
|
---|
[bf847d6d] | 297 | </seglistitem>
|
---|
| 298 | </segmentedlist>
|
---|
| 299 |
|
---|
| 300 | <variablelist>
|
---|
| 301 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 302 | <?dbfo list-presentation="list"?>
|
---|
| 303 | <?dbhtml list-presentation="table"?>
|
---|
| 304 |
|
---|
[03d30cf] | 305 | <varlistentry id="idle">
|
---|
[bf847d6d] | 306 | <term><command>idle</command></term>
|
---|
| 307 | <listitem>
|
---|
[181662f] | 308 | <para>
|
---|
| 309 | is a wrapper script that opens a <application>Python</application>
|
---|
[d0aecd33] | 310 | aware GUI editor. For this script to run, you must have installed
|
---|
| 311 | <application>Tk</application> before Python so that the Tkinter
|
---|
[4c24eb0a] | 312 | Python module is built
|
---|
[181662f] | 313 | </para>
|
---|
[03d30cf] | 314 | <indexterm zone="python2 idle">
|
---|
| 315 | <primary sortas="b-idle">idle</primary>
|
---|
[bf847d6d] | 316 | </indexterm>
|
---|
| 317 | </listitem>
|
---|
| 318 | </varlistentry>
|
---|
| 319 |
|
---|
| 320 | <varlistentry id="pydoc2">
|
---|
| 321 | <term><command>pydoc</command></term>
|
---|
| 322 | <listitem>
|
---|
[181662f] | 323 | <para>
|
---|
[4c24eb0a] | 324 | is the <application>Python</application> documentation tool
|
---|
[181662f] | 325 | </para>
|
---|
[4716d52] | 326 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 327 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 328 | </indexterm>
|
---|
| 329 | </listitem>
|
---|
| 330 | </varlistentry>
|
---|
| 331 |
|
---|
[181662f] | 332 | <varlistentry id="python">
|
---|
[61f684f2] | 333 | <term><command>python2</command></term>
|
---|
[bf847d6d] | 334 | <listitem>
|
---|
[181662f] | 335 | <para>
|
---|
| 336 | is an interpreted, interactive, object-oriented programming
|
---|
[4c24eb0a] | 337 | language
|
---|
[181662f] | 338 | </para>
|
---|
| 339 | <indexterm zone="python2 python">
|
---|
[4716d52] | 340 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 341 | </indexterm>
|
---|
| 342 | </listitem>
|
---|
| 343 | </varlistentry>
|
---|
| 344 |
|
---|
| 345 | <varlistentry id="python2-ver">
|
---|
| 346 | <term><command>python&python2-majorver;</command></term>
|
---|
| 347 | <listitem>
|
---|
[181662f] | 348 | <para>
|
---|
| 349 | is a version-specific name for the <command>python</command>
|
---|
[4c24eb0a] | 350 | program
|
---|
[181662f] | 351 | </para>
|
---|
[4716d52] | 352 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 353 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 354 | </indexterm>
|
---|
| 355 | </listitem>
|
---|
| 356 | </varlistentry>
|
---|
| 357 |
|
---|
[03d30cf] | 358 | <varlistentry id="smtpd.py">
|
---|
[bf847d6d] | 359 | <term><command>smtpd.py</command></term>
|
---|
| 360 | <listitem>
|
---|
[181662f] | 361 | <para>
|
---|
[4c24eb0a] | 362 | is an SMTP proxy implemented in <application>Python</application>
|
---|
[181662f] | 363 | </para>
|
---|
[03d30cf] | 364 | <indexterm zone="python2 smtpd.py">
|
---|
| 365 | <primary sortas="b-smtpd.py">smtpd.py</primary>
|
---|
[bf847d6d] | 366 | </indexterm>
|
---|
| 367 | </listitem>
|
---|
| 368 | </varlistentry>
|
---|
[82fac2c] | 369 |
|
---|
[bf847d6d] | 370 | </variablelist>
|
---|
[82fac2c] | 371 |
|
---|
[bf847d6d] | 372 | </sect2>
|
---|
[82fac2c] | 373 |
|
---|
[bf847d6d] | 374 | </sect1>
|
---|