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