aboutsummaryrefslogtreecommitdiffstats
path: root/chapter08/python.xml
blob: 7995f43dba51c6058eb765b57c00e55a3707dac7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?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;
]>

<sect1 id="ch-system-Python" role="wrap">
  <?dbhtml filename="Python.html"?>

  <sect1info condition="script">
    <productname>Python</productname>
    <productnumber>&python-version;</productnumber>
    <address>&python-url;</address>
  </sect1info>

  <title>Python-&python-version;</title>

  <indexterm zone="ch-system-Python">
    <primary sortas="a-Python">Python</primary>
  </indexterm>

  <sect2 role="package">
    <title/>

    <para>The Python 3 package contains the Python development environment. It
    is useful for object-oriented programming, writing scripts, prototyping
    large programs, or developing entire applications.</para>

    <segmentedlist>
      <segtitle>&buildtime;</segtitle>
      <segtitle>&diskspace;</segtitle>

      <seglistitem>
        <seg>&python-fin-sbu;</seg>
        <seg>&python-fin-du;</seg>
      </seglistitem>
    </segmentedlist>

  </sect2>

  <sect2 role="installation">
    <title>Installation of Python 3</title>

    <para>Prepare Python for compilation:</para>

<screen><userinput remap="configure">./configure --prefix=/usr       \
            --enable-shared     \
            --with-system-expat \
            --with-system-ffi   \
            --with-ensurepip=yes</userinput></screen>

    <variablelist>
      <title>The meaning of the configure options:</title>

    <varlistentry>
      <term><parameter>--with-system-expat</parameter></term>
      <listitem>
        <para>This switch enables linking against system version of
        <application>Expat</application>.</para>
       </listitem>
     </varlistentry>

    <varlistentry>
      <term><parameter>--with-system-ffi</parameter></term>
      <listitem>
        <para>This switch enables linking against system version of
        <application>libffi</application>.</para>
      </listitem>
    </varlistentry>

    <varlistentry>
      <term><parameter>--with-ensurepip=yes</parameter></term>
      <listitem>
        <para>This switch enables building <command>pip</command> and
        <command>setuptools</command> packaging programs.</para>
      </listitem>
    </varlistentry>

    </variablelist>

    <para>Compile the package:</para>

<screen><userinput remap="make">make</userinput></screen>

    <para>To test the results, issue:</para> 

<screen><userinput remap="test">make test</userinput></screen>

    <para>Some tests requiring a network connection or additional packages are
    skipped.  The test named test_normalization fails because network
    configuration is not completed yet.  For more comprehensive results,
    the test can be rerun when Python 3 is reinstalled in BLFS.</para>

    <para>Install the package:</para>

<screen><userinput remap="install">make install
chmod -v 755 /usr/lib/libpython&python-minor;.so
chmod -v 755 /usr/lib/libpython3.so
ln -sfv pip&python-minor; /usr/bin/pip3</userinput></screen>

    <variablelist>
      <title>The meaning of the install commands:</title>
<!-- ======  Change 8m if Python minor version changes ======= -->
    <varlistentry>
      <term><command>chmod -v 755 /usr/lib/libpython3.{8.,}so</command></term>
      <listitem>
        <para>Fix permissions for libraries to be consistent with other
        libraries.</para>
      </listitem>
    </varlistentry>

    </variablelist>

    <para>If desired, install the preformatted documentation:</para>

<screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html 

tar --strip-components=1  \
    --no-same-owner       \
    --no-same-permissions \
    -C /usr/share/doc/python-&python-version;/html \
    -xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>

    <variablelist>
      <title>The meaning of the documentation install commands:</title>

    <varlistentry>
      <term><option>--no-same-owner</option> and <option>--no-same-permissions</option></term>
      <listitem>
        <para>Ensure the installed files have the correct ownership and 
        permissions.  Without these options, using <application>tar</application>
        will install the package files with the upstream creator's values. 
        </para>
      </listitem>
    </varlistentry>

    </variablelist>

  </sect2>

  <sect2 id="contents-python" role="content">
    <title>Contents of Python 3</title>

    <segmentedlist>
      <segtitle>Installed Programs</segtitle>
      <segtitle>Installed Library</segtitle>
      <segtitle>Installed Directories</segtitle>

      <seglistitem>
        <seg>
          2to3, idle3, pip3, pydoc3, python3, and python3-config
        </seg>
        <seg>
          libpython&python-minor;.so and libpython3.so
        </seg>
        <seg>
          /usr/include/python&python-minor;, 
          /usr/lib/python3, and
          /usr/share/doc/python-&python-version;
        </seg>
      </seglistitem>
    </segmentedlist>

    <variablelist>
      <bridgehead renderas="sect3">Short Descriptions</bridgehead>
      <?dbfo list-presentation="list"?>
      <?dbhtml list-presentation="table"?>

      <varlistentry id="python-2to3">
        <term><command>2to3</command></term>
        <listitem>
          <para>
            is a <application>Python</application> program that reads
            <application>Python 2.x</application> source code and applies a
            series of fixes to transform it into 
            valid <application>Python 3.x</application> code.
          </para>
          <indexterm zone="ch-system-Python">
            <primary sortas="b-2to3">2to3</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="idle3">
        <term><command>idle3</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="ch-system-Python">
            <primary sortas="b-idle3">idle3</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pip3">
        <term><command>pip3</command></term>
        <listitem>
          <para>
            The package installer for Python. You can use pip to install
            packages from Python Package Index and other indexes.
          </para>
          <indexterm zone="ch-system-Python">
            <primary sortas="b-pip3">pip3</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="pydoc3">
        <term><command>pydoc3</command></term>
        <listitem>
          <para>
            is the <application>Python</application> documentation tool.
          </para>
          <indexterm zone="ch-system-Python">
            <primary sortas="b-pydoc3">pydoc3</primary>
          </indexterm>
        </listitem>
      </varlistentry>

      <varlistentry id="python3">
        <term><command>python3</command></term>
        <listitem>
          <para>
            is an interpreted, interactive, object-oriented programming
            language.
          </para>
          <indexterm zone="ch-system-Python">
            <primary sortas="b-python3">python3</primary>
          </indexterm>
        </listitem>
      </varlistentry>

    </variablelist>

  </sect2>

</sect1>