glfs/general/prog/python2.xml
Xi Ruoyao 45ab6c70c2
more SVN prop clean up
Remove "$LastChanged$" everywhere, and also some unused $Date$
2021-04-20 19:12:02 +08:00

366 lines
12 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY python2-download-http
"https://www.python.org/ftp/python/&python2-version;/Python-&python2-version;.tar.xz">
<!ENTITY python2-download-ftp " ">
<!ENTITY python2-md5sum "fd6cc8ec0a78c44036f825e739f36e5a">
<!ENTITY python2-size "12.2 MB">
<!ENTITY python2-buildsize "228 MB (add 17 MB for tests)">
<!ENTITY python2-time "0.5 SBU (Using parallelism=4; add 5.9 SBU for tests)">
<!ENTITY python2htmldoc-download-http
"https://docs.python.org/ftp/python/doc/&python2-version;/python-&python2-version;-docs-html.tar.bz2">
]>
<sect1 id="python2" xreflabel="Python-&python2-version;">
<?dbhtml filename="python2.html" ?>
<sect1info>
<date>$Date$</date>
</sect1info>
<title>Python-&python2-version;</title>
<indexterm zone="python2">
<primary sortas="a-Python2">Python2</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to Python 2</title>
<para>
The <application>Python 2</application> package contains the
<application>Python</application> development environment. It is useful
for object-oriented programming, writing scripts, prototyping large
programs or developing entire applications. This version is for backward
compatibility with other dependent packages.
</para>
<note>
<para>
Python2 has been deprecated by the upstream developers.
Support for Python2 was discontinued on January 1st, 2020.
</para>
<para>
BLFS is attempting to use Python3 as much as possible, but some
packages have not been updated to support Python3.
</para>
</note>
&lfs101_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&python2-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&python2-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &python2-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &python2-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &python2-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &python2-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Required patch:
<ulink url="&patch-root;/Python-&python2-version;-security_fixes-1.patch"/>
</para>
</listitem>
<listitem>
<para>
Optional HTML Documentation: <ulink url="&python2htmldoc-download-http;"/>
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Python 2 Dependencies</bridgehead>
<!--
<bridgehead renderas="sect4">Recommended</bridgehead>
<para role="recommended">
<xref linkend="libffi"/>
</para>
-->
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="bluez"/> and
<xref linkend="valgrind"/>
</para>
<bridgehead renderas="sect4">Optional (For Additional Modules)</bridgehead>
<para role="optional">
<xref linkend="sqlite"/> and
<xref linkend="tk"/>
</para>
<para condition="html" role="usernotes">
User Notes: <ulink url="&blfs-wiki;/Python"/>
</para>
</sect2>
<sect2 role="installation">
<title>Installation of Python 2</title>
<!--
<caution>
<para>
After installing this package or
updating <application>pip2</application> with the command
<command>pip2 install - -upgrade pip</command>, it will remove
<application>pip3</application> installed in LFS. To reset
<application>pip</application> and <application>pip3</application>,
run, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="nodump"><userinput>python3 -m pip install - -force pip</userinput></screen>
</caution>
-->
<para>
First, disable the installation of a script that overwrites a more
recent script:
</para>
<screen><userinput>sed -i '/2to3/d' ./setup.py</userinput></screen>
<para>
Install <application>Python 2</application> by running the following
commands:
</para>
<screen><userinput>patch -Np1 -i ../Python-&python2-version;-security_fixes-1.patch &amp;&amp;
./configure --prefix=/usr \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--enable-unicode=ucs4 &amp;&amp;
make</userinput></screen>
<para>
If you invoke the tests, they will run through twice.
To test the results, issue: <command>make -k test</command>.
</para>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>make altinstall &amp;&amp;
ln -s python2.7 /usr/bin/python2 &amp;&amp;
ln -s python2.7-config /usr/bin/python2-config &amp;&amp;
chmod -v 755 /usr/lib/libpython&python2-majorver;.so.1.0</userinput></screen>
<para>
Since <application>Python 2</application> is in maintenance mode, and
<application>Python 3</application> is recommended by upstream for
development, you probably do not need to install the documentation.
However, if you still want to install documentation for both
<application>Python</application> versions, be sure to define the
<envar>PYTHONDOCS</envar>
variable for the version you want to use, each time you need to consult
the documentation. If you have downloaded the preformatted documentation
from <ulink url="http://docs.python.org/download.html"/>, install it
as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>install -v -dm755 /usr/share/doc/python-&python2-version; &amp;&amp;
tar --strip-components=1 \
--no-same-owner \
--directory /usr/share/doc/python-&python2-version; \
-xvf ../python-&python2-version;-docs-html.tar.bz2 &amp;&amp;
find /usr/share/doc/python-&python2-version; -type d -exec chmod 0755 {} \; &amp;&amp;
find /usr/share/doc/python-&python2-version; -type f -exec chmod 0644 {} \;</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<parameter>--with-system-expat</parameter>: This switch enables linking
against system version of <application>Expat</application>.
</para>
<para>
<parameter>--with-system-ffi</parameter>: This switch enables linking
against system version of <application>libffi</application>.
</para>
<para>
<parameter>--enable-unicode=ucs4</parameter>: This switch enables
32bit Unicode support in <application>Python</application>.
</para>
<para>
<option>--with-ensurepip=yes</option> : This switch enables building
<command>pip</command> and <command>setuptools</command> packaging programs.
<command>setuptools</command> is needed for building some Python modules.
This switch is not recommended because this version of Python is being phased out.
</para>
<para>
<option>--with-dbmliborder=bdb:gdbm:ndbm</option>: Use this switch
if you want to build <application>Python</application> DBM Module
against <application>Berkeley DB</application> instead of
<application>GDBM</application>.
</para>
<para>
<command>make altinstall</command>: This make target omits some default
symbolic links that may interfere with Python 3.
</para>
<para>
<command>chmod ...</command>: Fix permissions for libraries to be
consistent with other libraries.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring Python 2</title>
<para>
In order for <command>python</command> to find the installed
documentation, you must add the following environment variable to
individual user's or the system's profile:
</para>
<screen role="root"><userinput>export PYTHONDOCS=/usr/share/doc/python-&python2-version;</userinput></screen>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Library</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
pydoc,
python2 (symlink),
python2-config (symlink),
python&python2-majorver;,
python&python2-majorver;-config,
smtpd.py, and
idle
</seg>
<seg>
libpython&python2-majorver;.so
</seg>
<seg>
/usr/{include,lib}/python&python2-majorver; and
/usr/share/doc/python-&python2-version;
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="idle">
<term><command>idle</command></term>
<listitem>
<para>
is a wrapper script that opens a <application>Python</application>
aware GUI editor. For this script to run, you must have installed
<application>Tk</application> before Python so that the Tkinter
Python module is built
</para>
<indexterm zone="python2 idle">
<primary sortas="b-idle">idle</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pydoc2">
<term><command>pydoc</command></term>
<listitem>
<para>
is the <application>Python</application> documentation tool
</para>
<indexterm zone="python2 pydoc2">
<primary sortas="b-pydoc2">pydoc</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="python">
<term><command>python2</command></term>
<listitem>
<para>
is an interpreted, interactive, object-oriented programming
language
</para>
<indexterm zone="python2 python">
<primary sortas="b-python2">python</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="python2-ver">
<term><command>python&python2-majorver;</command></term>
<listitem>
<para>
is a version-specific name for the <command>python</command>
program
</para>
<indexterm zone="python2 python2-ver">
<primary sortas="b-python&python2-majorver;">python&python2-majorver;</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="smtpd.py">
<term><command>smtpd.py</command></term>
<listitem>
<para>
is an SMTP proxy implemented in <application>Python</application>
</para>
<indexterm zone="python2 smtpd.py">
<primary sortas="b-smtpd.py">smtpd.py</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>