[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 |
|
---|
| 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 |
|
---|
[ed345e7] | 52 | &lfs120_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>
|
---|
[db8d276] | 106 |
|
---|
[82fac2c] | 107 | <bridgehead renderas="sect4">Recommended</bridgehead>
|
---|
| 108 | <para role="recommended">
|
---|
[f040dc0] | 109 | <xref linkend="sqlite"/> (For an additional module)
|
---|
[82fac2c] | 110 | </para>
|
---|
[db8d276] | 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 |
|
---|
[db8d276] | 118 | <bridgehead renderas="sect4">Optional (For more additional modules)</bridgehead>
|
---|
[82fac2c] | 119 | <para role="optional">
|
---|
[db8d276] | 120 | <xref linkend="libnsl"/> and
|
---|
[82fac2c] | 121 | <xref linkend="tk"/>
|
---|
[181662f] | 122 | </para>
|
---|
[cac7f93] | 123 |
|
---|
[bf847d6d] | 124 | <sect2 role="installation">
|
---|
[03d30cf] | 125 | <title>Installation of Python 2</title>
|
---|
[4343801] | 126 |
|
---|
[61f684f2] | 127 | <para>
|
---|
[8558044] | 128 | First, disable the installation of a script that overwrites a more
|
---|
[61f684f2] | 129 | recent script:
|
---|
| 130 | </para>
|
---|
| 131 |
|
---|
| 132 | <screen><userinput>sed -i '/2to3/d' ./setup.py</userinput></screen>
|
---|
[4343801] | 133 |
|
---|
[181662f] | 134 | <para>
|
---|
[03d30cf] | 135 | Install <application>Python 2</application> by running the following
|
---|
[181662f] | 136 | commands:
|
---|
| 137 | </para>
|
---|
[bf847d6d] | 138 |
|
---|
[8d52465b] | 139 | <screen><userinput>patch -Np1 -i ../Python-&python2-version;-security_fixes-1.patch &&
|
---|
[292ff45] | 140 | ./configure --prefix=/usr \
|
---|
| 141 | --enable-shared \
|
---|
| 142 | --with-system-expat \
|
---|
| 143 | --with-system-ffi \
|
---|
| 144 | --enable-unicode=ucs4 &&
|
---|
[bf847d6d] | 145 | make</userinput></screen>
|
---|
| 146 |
|
---|
[167a240] | 147 | <para>
|
---|
[292ff45] | 148 | If you invoke the tests, they will run through twice.
|
---|
[1a64240] | 149 | To test the results, issue: <command>make -k test</command>.
|
---|
[5f26bc36] | 150 | <!-- https://bugs.python.org/issue46811 -->
|
---|
| 151 | Several tests are known to fail, including
|
---|
| 152 | <literal>test_ftplib</literal>,
|
---|
| 153 | <literal>test_ssl</literal>,
|
---|
| 154 | <literal>test_urllib2_localnet</literal>,
|
---|
[046d740] | 155 | <literal>test_xml_etree</literal>,
|
---|
| 156 | <literal>test_xml_etree_c</literal>, and
|
---|
[5f26bc36] | 157 | <literal>test_minidom</literal>. These failures are due to
|
---|
| 158 | OpenSSL-3 and Expat-2.4.6.
|
---|
[181662f] | 159 | </para>
|
---|
[bf847d6d] | 160 |
|
---|
[181662f] | 161 | <para>
|
---|
| 162 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 163 | </para>
|
---|
[bf847d6d] | 164 |
|
---|
[61f684f2] | 165 | <screen role="root"><userinput>make altinstall &&
|
---|
| 166 | ln -s python2.7 /usr/bin/python2 &&
|
---|
| 167 | ln -s python2.7-config /usr/bin/python2-config &&
|
---|
[7224506] | 168 | chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
|
---|
[bf847d6d] | 169 |
|
---|
[181662f] | 170 | <para>
|
---|
[7fe0ce3b] | 171 | Since <application>Python 2</application> is in maintenance mode, and
|
---|
| 172 | <application>Python 3</application> is recommended by upstream for
|
---|
[8b9b43e] | 173 | development, you probably do not need to install the documentation.
|
---|
[7fe0ce3b] | 174 | However, if you still want to install documentation for both
|
---|
[8b9b43e] | 175 | <application>Python</application> versions, be sure to define the
|
---|
| 176 | <envar>PYTHONDOCS</envar>
|
---|
[7fe0ce3b] | 177 | variable for the version you want to use, each time you need to consult
|
---|
| 178 | the documentation. If you have downloaded the preformatted documentation
|
---|
[80106051] | 179 | from <ulink url="https://docs.python.org/download.html"/>, install it
|
---|
[03d30cf] | 180 | as the <systemitem class="username">root</systemitem> user:
|
---|
[181662f] | 181 | </para>
|
---|
| 182 |
|
---|
[23d3543c] | 183 | <screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &&
|
---|
[7b273030] | 184 |
|
---|
| 185 | tar --strip-components=1 \
|
---|
| 186 | --no-same-owner \
|
---|
| 187 | --directory /usr/share/doc/python-&python2-version; \
|
---|
| 188 | -xvf ../python-&python2-version;-docs-html.tar.bz2 &&
|
---|
| 189 |
|
---|
[03d30cf] | 190 | find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &&
|
---|
| 191 | find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
|
---|
[bf847d6d] | 192 | </sect2>
|
---|
| 193 |
|
---|
| 194 | <sect2 role="commands">
|
---|
| 195 | <title>Command Explanations</title>
|
---|
| 196 |
|
---|
[82fac2c] | 197 | <para>
|
---|
[00ff1df] | 198 | <parameter>--with-system-expat</parameter>: This switch enables linking
|
---|
| 199 | against system version of <application>Expat</application>.
|
---|
[82fac2c] | 200 | </para>
|
---|
| 201 |
|
---|
| 202 | <para>
|
---|
[00ff1df] | 203 | <parameter>--with-system-ffi</parameter>: This switch enables linking
|
---|
[8558044] | 204 | against system version of <application>libffi</application>.
|
---|
[82fac2c] | 205 | </para>
|
---|
| 206 |
|
---|
[23c5563] | 207 | <para>
|
---|
[9c76376] | 208 | <parameter>--enable-unicode=ucs4</parameter>: This switch enables
|
---|
[b9c353b] | 209 | 32-bit Unicode support in <application>Python</application>.
|
---|
[23c5563] | 210 | </para>
|
---|
| 211 |
|
---|
[82fac2c] | 212 | <para>
|
---|
[9c76376] | 213 | <option>--with-ensurepip=yes</option> : This switch enables building
|
---|
| 214 | <command>pip</command> and <command>setuptools</command> packaging programs.
|
---|
| 215 | <command>setuptools</command> is needed for building some Python modules.
|
---|
[1fe05eb] | 216 | This switch is not recommended because this version of Python is no longer
|
---|
[5ff8c3a] | 217 | maintained.
|
---|
[82fac2c] | 218 | </para>
|
---|
| 219 |
|
---|
| 220 | <para>
|
---|
[00ff1df] | 221 | <option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
|
---|
[0d7900a] | 222 | if you want to build <application>Python</application> DBM Module
|
---|
[82fac2c] | 223 | against <application>Berkeley DB</application> instead of
|
---|
| 224 | <application>GDBM</application>.
|
---|
| 225 | </para>
|
---|
| 226 |
|
---|
[61f684f2] | 227 | <para>
|
---|
[8558044] | 228 | <command>make altinstall</command>: This make target omits some default
|
---|
[61f684f2] | 229 | symbolic links that may interfere with Python 3.
|
---|
| 230 | </para>
|
---|
| 231 |
|
---|
[181662f] | 232 | <para>
|
---|
[0d7900a] | 233 | <command>chmod ...</command>: Fix permissions for libraries to be
|
---|
[181662f] | 234 | consistent with other libraries.
|
---|
| 235 | </para>
|
---|
[82fac2c] | 236 |
|
---|
[bf847d6d] | 237 | </sect2>
|
---|
| 238 |
|
---|
| 239 | <sect2 role="configuration">
|
---|
| 240 | <title>Configuring Python 2</title>
|
---|
| 241 |
|
---|
[181662f] | 242 | <para>
|
---|
| 243 | In order for <command>python</command> to find the installed
|
---|
| 244 | documentation, you must add the following environment variable to
|
---|
| 245 | individual user's or the system's profile:
|
---|
| 246 | </para>
|
---|
[bf847d6d] | 247 |
|
---|
[03d30cf] | 248 | <screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
|
---|
[82fac2c] | 249 |
|
---|
[bf847d6d] | 250 | </sect2>
|
---|
| 251 |
|
---|
| 252 | <sect2 role="content">
|
---|
| 253 | <title>Contents</title>
|
---|
| 254 |
|
---|
| 255 | <segmentedlist>
|
---|
| 256 | <segtitle>Installed Programs</segtitle>
|
---|
[03d30cf] | 257 | <segtitle>Installed Library</segtitle>
|
---|
[bf847d6d] | 258 | <segtitle>Installed Directories</segtitle>
|
---|
| 259 |
|
---|
| 260 | <seglistitem>
|
---|
[181662f] | 261 | <seg>
|
---|
[8558044] | 262 | pydoc,
|
---|
| 263 | python2 (symlink),
|
---|
[61f684f2] | 264 | python2-config (symlink),
|
---|
[8558044] | 265 | python&python2-majorver;,
|
---|
[61f684f2] | 266 | python&python2-majorver;-config,
|
---|
[8558044] | 267 | smtpd.py, and
|
---|
[61f684f2] | 268 | idle
|
---|
[181662f] | 269 | </seg>
|
---|
| 270 | <seg>
|
---|
[03d30cf] | 271 | libpython&python2-majorver;.so
|
---|
[181662f] | 272 | </seg>
|
---|
| 273 | <seg>
|
---|
[fcabde3c] | 274 | /usr/{include,lib}/python&python2-majorver; and
|
---|
| 275 | /usr/share/doc/python-&python2-version;
|
---|
| 276 | </seg>
|
---|
[bf847d6d] | 277 | </seglistitem>
|
---|
| 278 | </segmentedlist>
|
---|
| 279 |
|
---|
| 280 | <variablelist>
|
---|
| 281 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 282 | <?dbfo list-presentation="list"?>
|
---|
| 283 | <?dbhtml list-presentation="table"?>
|
---|
| 284 |
|
---|
[03d30cf] | 285 | <varlistentry id="idle">
|
---|
[bf847d6d] | 286 | <term><command>idle</command></term>
|
---|
| 287 | <listitem>
|
---|
[181662f] | 288 | <para>
|
---|
| 289 | is a wrapper script that opens a <application>Python</application>
|
---|
[d0aecd33] | 290 | aware GUI editor. For this script to run, you must have installed
|
---|
| 291 | <application>Tk</application> before Python so that the Tkinter
|
---|
[4c24eb0a] | 292 | Python module is built
|
---|
[181662f] | 293 | </para>
|
---|
[03d30cf] | 294 | <indexterm zone="python2 idle">
|
---|
| 295 | <primary sortas="b-idle">idle</primary>
|
---|
[bf847d6d] | 296 | </indexterm>
|
---|
| 297 | </listitem>
|
---|
| 298 | </varlistentry>
|
---|
| 299 |
|
---|
| 300 | <varlistentry id="pydoc2">
|
---|
| 301 | <term><command>pydoc</command></term>
|
---|
| 302 | <listitem>
|
---|
[181662f] | 303 | <para>
|
---|
[4c24eb0a] | 304 | is the <application>Python</application> documentation tool
|
---|
[181662f] | 305 | </para>
|
---|
[4716d52] | 306 | <indexterm zone="python2 pydoc2">
|
---|
[bf847d6d] | 307 | <primary sortas="b-pydoc2">pydoc</primary>
|
---|
| 308 | </indexterm>
|
---|
| 309 | </listitem>
|
---|
| 310 | </varlistentry>
|
---|
| 311 |
|
---|
[181662f] | 312 | <varlistentry id="python">
|
---|
[61f684f2] | 313 | <term><command>python2</command></term>
|
---|
[bf847d6d] | 314 | <listitem>
|
---|
[181662f] | 315 | <para>
|
---|
| 316 | is an interpreted, interactive, object-oriented programming
|
---|
[4c24eb0a] | 317 | language
|
---|
[181662f] | 318 | </para>
|
---|
| 319 | <indexterm zone="python2 python">
|
---|
[4716d52] | 320 | <primary sortas="b-python2">python</primary>
|
---|
[bf847d6d] | 321 | </indexterm>
|
---|
| 322 | </listitem>
|
---|
| 323 | </varlistentry>
|
---|
| 324 |
|
---|
| 325 | <varlistentry id="python2-ver">
|
---|
| 326 | <term><command>python&python2-majorver;</command></term>
|
---|
| 327 | <listitem>
|
---|
[181662f] | 328 | <para>
|
---|
| 329 | is a version-specific name for the <command>python</command>
|
---|
[4c24eb0a] | 330 | program
|
---|
[181662f] | 331 | </para>
|
---|
[4716d52] | 332 | <indexterm zone="python2 python2-ver">
|
---|
[b88be39] | 333 | <primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
|
---|
[bf847d6d] | 334 | </indexterm>
|
---|
| 335 | </listitem>
|
---|
| 336 | </varlistentry>
|
---|
| 337 |
|
---|
[03d30cf] | 338 | <varlistentry id="smtpd.py">
|
---|
[bf847d6d] | 339 | <term><command>smtpd.py</command></term>
|
---|
| 340 | <listitem>
|
---|
[181662f] | 341 | <para>
|
---|
[4c24eb0a] | 342 | is an SMTP proxy implemented in <application>Python</application>
|
---|
[181662f] | 343 | </para>
|
---|
[03d30cf] | 344 | <indexterm zone="python2 smtpd.py">
|
---|
| 345 | <primary sortas="b-smtpd.py">smtpd.py</primary>
|
---|
[bf847d6d] | 346 | </indexterm>
|
---|
| 347 | </listitem>
|
---|
| 348 | </varlistentry>
|
---|
[82fac2c] | 349 |
|
---|
[bf847d6d] | 350 | </variablelist>
|
---|
[82fac2c] | 351 |
|
---|
[bf847d6d] | 352 | </sect2>
|
---|
[82fac2c] | 353 |
|
---|
[bf847d6d] | 354 | </sect1>
|
---|