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