~dkuhlman/python-training-materials/Materials

« back to all changes in this revision

Viewing changes to python-3.5.1-docs-html/distutils/apiref.html

  • Committer: Dave Kuhlman
  • Date: 2017-04-15 16:24:56 UTC
  • Revision ID: dkuhlman@davekuhlman.org-20170415162456-iav9vozzg4iwqwv3
Updated docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
 
 
4
 
 
5
 
<html xmlns="http://www.w3.org/1999/xhtml">
6
 
  <head>
7
 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
 
    
9
 
    <title>10. API Reference &mdash; Python 3.5.1 documentation</title>
10
 
    
11
 
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
12
 
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
 
    
14
 
    <script type="text/javascript">
15
 
      var DOCUMENTATION_OPTIONS = {
16
 
        URL_ROOT:    '../',
17
 
        VERSION:     '3.5.1',
18
 
        COLLAPSE_INDEX: false,
19
 
        FILE_SUFFIX: '.html',
20
 
        HAS_SOURCE:  true
21
 
      };
22
 
    </script>
23
 
    <script type="text/javascript" src="../_static/jquery.js"></script>
24
 
    <script type="text/javascript" src="../_static/underscore.js"></script>
25
 
    <script type="text/javascript" src="../_static/doctools.js"></script>
26
 
    <script type="text/javascript" src="../_static/sidebar.js"></script>
27
 
    <link rel="search" type="application/opensearchdescription+xml"
28
 
          title="Search within Python 3.5.1 documentation"
29
 
          href="../_static/opensearch.xml"/>
30
 
    <link rel="author" title="About these documents" href="../about.html" />
31
 
    <link rel="copyright" title="Copyright" href="../copyright.html" />
32
 
    <link rel="top" title="Python 3.5.1 documentation" href="../contents.html" />
33
 
    <link rel="up" title="Distributing Python Modules (Legacy version)" href="index.html" />
34
 
    <link rel="next" title="Installing Python Modules (Legacy version)" href="../install/index.html" />
35
 
    <link rel="prev" title="9. Command Reference" href="commandref.html" />
36
 
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
37
 
    <script type="text/javascript" src="../_static/copybutton.js"></script>
38
 
    <script type="text/javascript" src="../_static/version_switch.js"></script>
39
 
    
40
 
 
41
 
 
42
 
  </head>
43
 
  <body role="document">  
44
 
    <div class="related" role="navigation" aria-label="related navigation">
45
 
      <h3>Navigation</h3>
46
 
      <ul>
47
 
        <li class="right" style="margin-right: 10px">
48
 
          <a href="../genindex.html" title="General Index"
49
 
             accesskey="I">index</a></li>
50
 
        <li class="right" >
51
 
          <a href="../py-modindex.html" title="Python Module Index"
52
 
             >modules</a> |</li>
53
 
        <li class="right" >
54
 
          <a href="../install/index.html" title="Installing Python Modules (Legacy version)"
55
 
             accesskey="N">next</a> |</li>
56
 
        <li class="right" >
57
 
          <a href="commandref.html" title="9. Command Reference"
58
 
             accesskey="P">previous</a> |</li>
59
 
        <li><img src="../_static/py.png" alt=""
60
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
61
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
62
 
        <li>
63
 
          <span class="version_switcher_placeholder">3.5.1</span>
64
 
          <a href="../index.html">Documentation </a> &raquo;
65
 
        </li>
66
 
 
67
 
          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Distributing Python Modules (Legacy version)</a> &raquo;</li> 
68
 
      </ul>
69
 
    </div>    
70
 
 
71
 
    <div class="document">
72
 
      <div class="documentwrapper">
73
 
        <div class="bodywrapper">
74
 
          <div class="body" role="main">
75
 
            
76
 
  <div class="section" id="api-reference">
77
 
<span id="id1"></span><h1>10. API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h1>
78
 
<div class="section" id="module-distutils.core">
79
 
<span id="distutils-core-core-distutils-functionality"></span><h2>10.1. <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> &#8212; Core Distutils functionality<a class="headerlink" href="#module-distutils.core" title="Permalink to this headline">¶</a></h2>
80
 
<p>The <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> module is the only module that needs to be installed
81
 
to use the Distutils. It provides the <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> (which is called from the
82
 
setup script). Indirectly provides the  <code class="xref py py-class docutils literal"><span class="pre">distutils.dist.Distribution</span></code> and
83
 
<a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">distutils.cmd.Command</span></code></a> class.</p>
84
 
<dl class="function">
85
 
<dt id="distutils.core.setup">
86
 
<code class="descclassname">distutils.core.</code><code class="descname">setup</code><span class="sig-paren">(</span><em>arguments</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.core.setup" title="Permalink to this definition">¶</a></dt>
87
 
<dd><p>The basic do-everything function that does most everything you could ever ask
88
 
for from a Distutils method.</p>
89
 
<p>The setup function takes a large number of arguments. These are laid out in the
90
 
following table.</p>
91
 
<table border="1" class="docutils">
92
 
<colgroup>
93
 
<col width="18%" />
94
 
<col width="28%" />
95
 
<col width="54%" />
96
 
</colgroup>
97
 
<thead valign="bottom">
98
 
<tr class="row-odd"><th class="head">argument name</th>
99
 
<th class="head">value</th>
100
 
<th class="head">type</th>
101
 
</tr>
102
 
</thead>
103
 
<tbody valign="top">
104
 
<tr class="row-even"><td><em>name</em></td>
105
 
<td>The name of the package</td>
106
 
<td>a string</td>
107
 
</tr>
108
 
<tr class="row-odd"><td><em>version</em></td>
109
 
<td>The version number of the
110
 
package; see
111
 
<a class="reference internal" href="#module-distutils.version" title="distutils.version: implements classes that represent module version numbers."><code class="xref py py-mod docutils literal"><span class="pre">distutils.version</span></code></a></td>
112
 
<td>a string</td>
113
 
</tr>
114
 
<tr class="row-even"><td><em>description</em></td>
115
 
<td>A single line describing the
116
 
package</td>
117
 
<td>a string</td>
118
 
</tr>
119
 
<tr class="row-odd"><td><em>long_description</em></td>
120
 
<td>Longer description of the
121
 
package</td>
122
 
<td>a string</td>
123
 
</tr>
124
 
<tr class="row-even"><td><em>author</em></td>
125
 
<td>The name of the package author</td>
126
 
<td>a string</td>
127
 
</tr>
128
 
<tr class="row-odd"><td><em>author_email</em></td>
129
 
<td>The email address of the
130
 
package author</td>
131
 
<td>a string</td>
132
 
</tr>
133
 
<tr class="row-even"><td><em>maintainer</em></td>
134
 
<td>The name of the current
135
 
maintainer, if different from
136
 
the author. Note that if
137
 
the maintainer is provided,
138
 
distutils will use it as the
139
 
author in <code class="file docutils literal"><span class="pre">PKG-INFO</span></code></td>
140
 
<td>a string</td>
141
 
</tr>
142
 
<tr class="row-odd"><td><em>maintainer_email</em></td>
143
 
<td>The email address of the
144
 
current maintainer, if
145
 
different from the author</td>
146
 
<td>a string</td>
147
 
</tr>
148
 
<tr class="row-even"><td><em>url</em></td>
149
 
<td>A URL for the package
150
 
(homepage)</td>
151
 
<td>a string</td>
152
 
</tr>
153
 
<tr class="row-odd"><td><em>download_url</em></td>
154
 
<td>A URL to download the package</td>
155
 
<td>a string</td>
156
 
</tr>
157
 
<tr class="row-even"><td><em>packages</em></td>
158
 
<td>A list of Python packages that
159
 
distutils will manipulate</td>
160
 
<td>a list of strings</td>
161
 
</tr>
162
 
<tr class="row-odd"><td><em>py_modules</em></td>
163
 
<td>A list of Python modules that
164
 
distutils will manipulate</td>
165
 
<td>a list of strings</td>
166
 
</tr>
167
 
<tr class="row-even"><td><em>scripts</em></td>
168
 
<td>A list of standalone script
169
 
files to be built and
170
 
installed</td>
171
 
<td>a list of strings</td>
172
 
</tr>
173
 
<tr class="row-odd"><td><em>ext_modules</em></td>
174
 
<td>A list of Python extensions to
175
 
be built</td>
176
 
<td>a list of instances of
177
 
<a class="reference internal" href="#distutils.core.Extension" title="distutils.core.Extension"><code class="xref py py-class docutils literal"><span class="pre">distutils.core.Extension</span></code></a></td>
178
 
</tr>
179
 
<tr class="row-even"><td><em>classifiers</em></td>
180
 
<td>A list of categories for the
181
 
package</td>
182
 
<td>a list of strings; valid classifiers are listed on <a class="reference external" href="https://pypi.python.org/pypi?:action=list_classifiers">PyPI</a>.</td>
183
 
</tr>
184
 
<tr class="row-odd"><td><em>distclass</em></td>
185
 
<td>the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a>
186
 
class to use</td>
187
 
<td>a subclass of
188
 
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">distutils.core.Distribution</span></code></a></td>
189
 
</tr>
190
 
<tr class="row-even"><td><em>script_name</em></td>
191
 
<td>The name of the setup.py
192
 
script - defaults to
193
 
<code class="docutils literal"><span class="pre">sys.argv[0]</span></code></td>
194
 
<td>a string</td>
195
 
</tr>
196
 
<tr class="row-odd"><td><em>script_args</em></td>
197
 
<td>Arguments to supply to the
198
 
setup script</td>
199
 
<td>a list of strings</td>
200
 
</tr>
201
 
<tr class="row-even"><td><em>options</em></td>
202
 
<td>default options for the setup
203
 
script</td>
204
 
<td>a dictionary</td>
205
 
</tr>
206
 
<tr class="row-odd"><td><em>license</em></td>
207
 
<td>The license for the package</td>
208
 
<td>a string</td>
209
 
</tr>
210
 
<tr class="row-even"><td><em>keywords</em></td>
211
 
<td>Descriptive meta-data, see
212
 
<span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0314"><strong>PEP 314</strong></a></td>
213
 
<td>a list of strings or a comma-separated string</td>
214
 
</tr>
215
 
<tr class="row-odd"><td><em>platforms</em></td>
216
 
<td>&nbsp;</td>
217
 
<td>a list of strings or a comma-separated string</td>
218
 
</tr>
219
 
<tr class="row-even"><td><em>cmdclass</em></td>
220
 
<td>A mapping of command names to
221
 
<a class="reference internal" href="#distutils.core.Command" title="distutils.core.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> subclasses</td>
222
 
<td>a dictionary</td>
223
 
</tr>
224
 
<tr class="row-odd"><td><em>data_files</em></td>
225
 
<td>A list of data files to
226
 
install</td>
227
 
<td>a list</td>
228
 
</tr>
229
 
<tr class="row-even"><td><em>package_dir</em></td>
230
 
<td>A mapping of package to
231
 
directory names</td>
232
 
<td>a dictionary</td>
233
 
</tr>
234
 
</tbody>
235
 
</table>
236
 
</dd></dl>
237
 
 
238
 
<dl class="function">
239
 
<dt id="distutils.core.run_setup">
240
 
<code class="descclassname">distutils.core.</code><code class="descname">run_setup</code><span class="sig-paren">(</span><em>script_name</em><span class="optional">[</span>, <em>script_args=None</em>, <em>stop_after='run'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.core.run_setup" title="Permalink to this definition">¶</a></dt>
241
 
<dd><p>Run a setup script in a somewhat controlled environment, and return  the
242
 
<code class="xref py py-class docutils literal"><span class="pre">distutils.dist.Distribution</span></code> instance that drives things.   This is
243
 
useful if you need to find out the distribution meta-data  (passed as keyword
244
 
args from <em>script</em> to <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a>), or  the contents of the config files or
245
 
command-line.</p>
246
 
<p><em>script_name</em> is a file that will be read and run with <a class="reference internal" href="../library/functions.html#exec" title="exec"><code class="xref py py-func docutils literal"><span class="pre">exec()</span></code></a>.  <code class="docutils literal"><span class="pre">sys.argv[0]</span></code>
247
 
will be replaced with <em>script</em> for the duration of the call.  <em>script_args</em> is a
248
 
list of strings; if supplied, <code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> will be replaced by <em>script_args</em>
249
 
for the duration  of the call.</p>
250
 
<p><em>stop_after</em> tells <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> when to stop processing; possible  values:</p>
251
 
<table border="1" class="docutils">
252
 
<colgroup>
253
 
<col width="25%" />
254
 
<col width="75%" />
255
 
</colgroup>
256
 
<thead valign="bottom">
257
 
<tr class="row-odd"><th class="head">value</th>
258
 
<th class="head">description</th>
259
 
</tr>
260
 
</thead>
261
 
<tbody valign="top">
262
 
<tr class="row-even"><td><em>init</em></td>
263
 
<td>Stop after the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a>
264
 
instance has been created  and populated
265
 
with the keyword arguments to <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a></td>
266
 
</tr>
267
 
<tr class="row-odd"><td><em>config</em></td>
268
 
<td>Stop after config files have been parsed
269
 
(and their data stored in the
270
 
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance)</td>
271
 
</tr>
272
 
<tr class="row-even"><td><em>commandline</em></td>
273
 
<td>Stop after the command-line
274
 
(<code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> or  <em>script_args</em>) have
275
 
been parsed (and the data stored in the
276
 
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance.)</td>
277
 
</tr>
278
 
<tr class="row-odd"><td><em>run</em></td>
279
 
<td>Stop after all commands have been run (the
280
 
same as  if <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> had been called
281
 
in the usual way). This is the default
282
 
value.</td>
283
 
</tr>
284
 
</tbody>
285
 
</table>
286
 
</dd></dl>
287
 
 
288
 
<p>In addition, the <a class="reference internal" href="#module-distutils.core" title="distutils.core: The core Distutils functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.core</span></code></a> module exposed a number of  classes that
289
 
live elsewhere.</p>
290
 
<ul class="simple">
291
 
<li><code class="xref py py-class docutils literal"><span class="pre">Extension</span></code> from <a class="reference internal" href="#module-distutils.extension" title="distutils.extension: Provides the Extension class, used to describe C/C++ extension modules in setup scripts"><code class="xref py py-mod docutils literal"><span class="pre">distutils.extension</span></code></a></li>
292
 
<li><a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> from <a class="reference internal" href="#module-distutils.cmd" title="distutils.cmd: This module provides the abstract base class Command. This class is subclassed by the modules in the distutils.command subpackage."><code class="xref py py-mod docutils literal"><span class="pre">distutils.cmd</span></code></a></li>
293
 
<li><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code> from <a class="reference internal" href="#module-distutils.dist" title="distutils.dist: Provides the Distribution class, which represents the module distribution being built/installed/distributed"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dist</span></code></a></li>
294
 
</ul>
295
 
<p>A short description of each of these follows, but see the relevant module for
296
 
the full reference.</p>
297
 
<dl class="class">
298
 
<dt id="distutils.core.Extension">
299
 
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Extension</code><a class="headerlink" href="#distutils.core.Extension" title="Permalink to this definition">¶</a></dt>
300
 
<dd><p>The Extension class describes a single C or C++extension module in a setup
301
 
script. It accepts the following keyword arguments in its constructor:</p>
302
 
<table border="1" class="docutils">
303
 
<colgroup>
304
 
<col width="29%" />
305
 
<col width="39%" />
306
 
<col width="33%" />
307
 
</colgroup>
308
 
<thead valign="bottom">
309
 
<tr class="row-odd"><th class="head">argument name</th>
310
 
<th class="head">value</th>
311
 
<th class="head">type</th>
312
 
</tr>
313
 
</thead>
314
 
<tbody valign="top">
315
 
<tr class="row-even"><td><em>name</em></td>
316
 
<td>the full name of the
317
 
extension, including any
318
 
packages &#8212; ie. <em>not</em> a
319
 
filename or pathname, but
320
 
Python dotted name</td>
321
 
<td>a string</td>
322
 
</tr>
323
 
<tr class="row-odd"><td><em>sources</em></td>
324
 
<td>list of source filenames,
325
 
relative to the distribution
326
 
root (where the setup script
327
 
lives), in Unix form (slash-
328
 
separated) for portability.
329
 
Source files may be C, C++,
330
 
SWIG (.i), platform-specific
331
 
resource files, or whatever
332
 
else is recognized by the
333
 
<strong class="command">build_ext</strong> command
334
 
as source for a Python
335
 
extension.</td>
336
 
<td>a list of strings</td>
337
 
</tr>
338
 
<tr class="row-even"><td><em>include_dirs</em></td>
339
 
<td>list of directories to search
340
 
for C/C++ header files (in
341
 
Unix form for portability)</td>
342
 
<td>a list of strings</td>
343
 
</tr>
344
 
<tr class="row-odd"><td><em>define_macros</em></td>
345
 
<td>list of macros to define; each
346
 
macro is defined using a
347
 
2-tuple <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code>,
348
 
where <em>value</em> is
349
 
either the string to define it
350
 
to or <code class="docutils literal"><span class="pre">None</span></code> to define it
351
 
without a particular value
352
 
(equivalent of <code class="docutils literal"><span class="pre">#define</span> <span class="pre">FOO</span></code>
353
 
in source or <code class="xref std std-option docutils literal"><span class="pre">-DFOO</span></code>
354
 
on Unix C compiler command
355
 
line)</td>
356
 
<td>a list of tuples</td>
357
 
</tr>
358
 
<tr class="row-even"><td><em>undef_macros</em></td>
359
 
<td>list of macros to undefine
360
 
explicitly</td>
361
 
<td>a list of strings</td>
362
 
</tr>
363
 
<tr class="row-odd"><td><em>library_dirs</em></td>
364
 
<td>list of directories to search
365
 
for C/C++ libraries at link
366
 
time</td>
367
 
<td>a list of strings</td>
368
 
</tr>
369
 
<tr class="row-even"><td><em>libraries</em></td>
370
 
<td>list of library names (not
371
 
filenames or paths) to link
372
 
against</td>
373
 
<td>a list of strings</td>
374
 
</tr>
375
 
<tr class="row-odd"><td><em>runtime_library_dirs</em></td>
376
 
<td>list of directories to search
377
 
for C/C++ libraries at run
378
 
time (for shared extensions,
379
 
this is when the extension is
380
 
loaded)</td>
381
 
<td>a list of strings</td>
382
 
</tr>
383
 
<tr class="row-even"><td><em>extra_objects</em></td>
384
 
<td>list of extra files to link
385
 
with (eg. object files not
386
 
implied by &#8216;sources&#8217;, static
387
 
library that must be
388
 
explicitly specified, binary
389
 
resource files, etc.)</td>
390
 
<td>a list of strings</td>
391
 
</tr>
392
 
<tr class="row-odd"><td><em>extra_compile_args</em></td>
393
 
<td>any extra platform- and
394
 
compiler-specific information
395
 
to use when compiling the
396
 
source files in &#8216;sources&#8217;. For
397
 
platforms and compilers where
398
 
a command line makes sense,
399
 
this is typically a list of
400
 
command-line arguments, but
401
 
for other platforms it could
402
 
be anything.</td>
403
 
<td>a list of strings</td>
404
 
</tr>
405
 
<tr class="row-even"><td><em>extra_link_args</em></td>
406
 
<td>any extra platform- and
407
 
compiler-specific information
408
 
to use when linking object
409
 
files together to create the
410
 
extension (or to create a new
411
 
static Python interpreter).
412
 
Similar interpretation as for
413
 
&#8216;extra_compile_args&#8217;.</td>
414
 
<td>a list of strings</td>
415
 
</tr>
416
 
<tr class="row-odd"><td><em>export_symbols</em></td>
417
 
<td>list of symbols to be exported
418
 
from a shared extension. Not
419
 
used on all platforms, and not
420
 
generally necessary for Python
421
 
extensions, which typically
422
 
export exactly one symbol:
423
 
<code class="docutils literal"><span class="pre">init</span></code> + extension_name.</td>
424
 
<td>a list of strings</td>
425
 
</tr>
426
 
<tr class="row-even"><td><em>depends</em></td>
427
 
<td>list of files that the
428
 
extension depends on</td>
429
 
<td>a list of strings</td>
430
 
</tr>
431
 
<tr class="row-odd"><td><em>language</em></td>
432
 
<td>extension language (i.e.
433
 
<code class="docutils literal"><span class="pre">'c'</span></code>, <code class="docutils literal"><span class="pre">'c++'</span></code>,
434
 
<code class="docutils literal"><span class="pre">'objc'</span></code>). Will be detected
435
 
from the source extensions if
436
 
not provided.</td>
437
 
<td>a string</td>
438
 
</tr>
439
 
<tr class="row-even"><td><em>optional</em></td>
440
 
<td>specifies that a build failure
441
 
in the extension should not
442
 
abort the build process, but
443
 
simply skip the extension.</td>
444
 
<td>a boolean</td>
445
 
</tr>
446
 
</tbody>
447
 
</table>
448
 
</dd></dl>
449
 
 
450
 
<dl class="class">
451
 
<dt id="distutils.core.Distribution">
452
 
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Distribution</code><a class="headerlink" href="#distutils.core.Distribution" title="Permalink to this definition">¶</a></dt>
453
 
<dd><p>A <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> describes how to build, install and package up a Python
454
 
software package.</p>
455
 
<p>See the <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> function for a list of keyword arguments accepted  by the
456
 
Distribution constructor. <a class="reference internal" href="#distutils.core.setup" title="distutils.core.setup"><code class="xref py py-func docutils literal"><span class="pre">setup()</span></code></a> creates a Distribution instance.</p>
457
 
</dd></dl>
458
 
 
459
 
<dl class="class">
460
 
<dt id="distutils.core.Command">
461
 
<em class="property">class </em><code class="descclassname">distutils.core.</code><code class="descname">Command</code><a class="headerlink" href="#distutils.core.Command" title="Permalink to this definition">¶</a></dt>
462
 
<dd><p>A <a class="reference internal" href="#distutils.core.Command" title="distutils.core.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> class (or rather, an instance of one of its subclasses)
463
 
implement a single distutils command.</p>
464
 
</dd></dl>
465
 
 
466
 
</div>
467
 
<div class="section" id="module-distutils.ccompiler">
468
 
<span id="distutils-ccompiler-ccompiler-base-class"></span><h2>10.2. <a class="reference internal" href="#module-distutils.ccompiler" title="distutils.ccompiler: Abstract CCompiler class"><code class="xref py py-mod docutils literal"><span class="pre">distutils.ccompiler</span></code></a> &#8212; CCompiler base class<a class="headerlink" href="#module-distutils.ccompiler" title="Permalink to this headline">¶</a></h2>
469
 
<p>This module provides the abstract base class for the <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a>
470
 
classes.  A <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> instance can be used for all the compile  and
471
 
link steps needed to build a single project. Methods are provided to  set
472
 
options for the compiler &#8212; macro definitions, include directories,  link path,
473
 
libraries and the like.</p>
474
 
<p>This module provides the following functions.</p>
475
 
<dl class="function">
476
 
<dt id="distutils.ccompiler.gen_lib_options">
477
 
<code class="descclassname">distutils.ccompiler.</code><code class="descname">gen_lib_options</code><span class="sig-paren">(</span><em>compiler</em>, <em>library_dirs</em>, <em>runtime_library_dirs</em>, <em>libraries</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.gen_lib_options" title="Permalink to this definition">¶</a></dt>
478
 
<dd><p>Generate linker options for searching library directories and linking with
479
 
specific libraries.  <em>libraries</em> and <em>library_dirs</em> are, respectively, lists of
480
 
library names (not filenames!) and search directories.  Returns a list of
481
 
command-line options suitable for use with some compiler (depending on the two
482
 
format strings passed in).</p>
483
 
</dd></dl>
484
 
 
485
 
<dl class="function">
486
 
<dt id="distutils.ccompiler.gen_preprocess_options">
487
 
<code class="descclassname">distutils.ccompiler.</code><code class="descname">gen_preprocess_options</code><span class="sig-paren">(</span><em>macros</em>, <em>include_dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.gen_preprocess_options" title="Permalink to this definition">¶</a></dt>
488
 
<dd><p>Generate C pre-processor options (<code class="xref std std-option docutils literal"><span class="pre">-D</span></code>, <code class="xref std std-option docutils literal"><span class="pre">-U</span></code>, <a class="reference internal" href="../using/cmdline.html#cmdoption-I"><code class="xref std std-option docutils literal"><span class="pre">-I</span></code></a>) as
489
 
used by at least two types of compilers: the typical Unix compiler and Visual
490
 
C++. <em>macros</em> is the usual thing, a list of 1- or 2-tuples, where <code class="docutils literal"><span class="pre">(name,)</span></code>
491
 
means undefine (<code class="xref std std-option docutils literal"><span class="pre">-U</span></code>) macro <em>name</em>, and <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code> means define
492
 
(<code class="xref std std-option docutils literal"><span class="pre">-D</span></code>) macro <em>name</em> to <em>value</em>.  <em>include_dirs</em> is just a list of
493
 
directory names to be added to the header file search path (<a class="reference internal" href="../using/cmdline.html#cmdoption-I"><code class="xref std std-option docutils literal"><span class="pre">-I</span></code></a>).
494
 
Returns a list of command-line options suitable for either Unix compilers or
495
 
Visual C++.</p>
496
 
</dd></dl>
497
 
 
498
 
<dl class="function">
499
 
<dt id="distutils.ccompiler.get_default_compiler">
500
 
<code class="descclassname">distutils.ccompiler.</code><code class="descname">get_default_compiler</code><span class="sig-paren">(</span><em>osname</em>, <em>platform</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.get_default_compiler" title="Permalink to this definition">¶</a></dt>
501
 
<dd><p>Determine the default compiler to use for the given platform.</p>
502
 
<p><em>osname</em> should be one of the standard Python OS names (i.e. the ones returned
503
 
by <code class="docutils literal"><span class="pre">os.name</span></code>) and <em>platform</em> the common value returned by <code class="docutils literal"><span class="pre">sys.platform</span></code> for
504
 
the platform in question.</p>
505
 
<p>The default values are <code class="docutils literal"><span class="pre">os.name</span></code> and <code class="docutils literal"><span class="pre">sys.platform</span></code> in case the parameters
506
 
are not given.</p>
507
 
</dd></dl>
508
 
 
509
 
<dl class="function">
510
 
<dt id="distutils.ccompiler.new_compiler">
511
 
<code class="descclassname">distutils.ccompiler.</code><code class="descname">new_compiler</code><span class="sig-paren">(</span><em>plat=None</em>, <em>compiler=None</em>, <em>verbose=0</em>, <em>dry_run=0</em>, <em>force=0</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.new_compiler" title="Permalink to this definition">¶</a></dt>
512
 
<dd><p>Factory function to generate an instance of some CCompiler subclass for the
513
 
supplied platform/compiler combination. <em>plat</em> defaults to <code class="docutils literal"><span class="pre">os.name</span></code> (eg.
514
 
<code class="docutils literal"><span class="pre">'posix'</span></code>, <code class="docutils literal"><span class="pre">'nt'</span></code>), and <em>compiler</em>  defaults to the default compiler for
515
 
that platform. Currently only <code class="docutils literal"><span class="pre">'posix'</span></code> and <code class="docutils literal"><span class="pre">'nt'</span></code> are supported, and the
516
 
default compilers are &#8220;traditional Unix interface&#8221; (<code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code>
517
 
class) and Visual C++ (<code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> class).  Note that it&#8217;s perfectly
518
 
possible to ask for a Unix compiler object under Windows, and a Microsoft
519
 
compiler object under Unix&#8212;if you supply a value for <em>compiler</em>, <em>plat</em> is
520
 
ignored.</p>
521
 
</dd></dl>
522
 
 
523
 
<dl class="function">
524
 
<dt id="distutils.ccompiler.show_compilers">
525
 
<code class="descclassname">distutils.ccompiler.</code><code class="descname">show_compilers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.show_compilers" title="Permalink to this definition">¶</a></dt>
526
 
<dd><p>Print list of available compilers (used by the <code class="xref std std-option docutils literal"><span class="pre">--help-compiler</span></code> options
527
 
to <strong class="command">build</strong>, <strong class="command">build_ext</strong>, <strong class="command">build_clib</strong>).</p>
528
 
</dd></dl>
529
 
 
530
 
<dl class="class">
531
 
<dt id="distutils.ccompiler.CCompiler">
532
 
<em class="property">class </em><code class="descclassname">distutils.ccompiler.</code><code class="descname">CCompiler</code><span class="sig-paren">(</span><span class="optional">[</span><em>verbose=0</em>, <em>dry_run=0</em>, <em>force=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler" title="Permalink to this definition">¶</a></dt>
533
 
<dd><p>The abstract base class <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> defines the interface that  must be
534
 
implemented by real compiler classes.  The class also has  some utility methods
535
 
used by several compiler classes.</p>
536
 
<p>The basic idea behind a compiler abstraction class is that each instance can be
537
 
used for all the compile/link steps in building a single project.  Thus,
538
 
attributes common to all of those compile and link steps &#8212; include
539
 
directories, macros to define, libraries to link against, etc. &#8212; are
540
 
attributes of the compiler instance.  To allow for variability in how individual
541
 
files are treated, most of those attributes may be varied on a per-compilation
542
 
or per-link basis.</p>
543
 
<p>The constructor for each subclass creates an instance of the Compiler object.
544
 
Flags are <em>verbose</em> (show verbose output), <em>dry_run</em> (don&#8217;t actually execute the
545
 
steps) and <em>force</em> (rebuild everything, regardless of dependencies). All of
546
 
these flags default to <code class="docutils literal"><span class="pre">0</span></code> (off). Note that you probably don&#8217;t want to
547
 
instantiate <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> or one of its subclasses directly - use the
548
 
<code class="xref py py-func docutils literal"><span class="pre">distutils.CCompiler.new_compiler()</span></code> factory function instead.</p>
549
 
<p>The following methods allow you to manually alter compiler options for  the
550
 
instance of the Compiler class.</p>
551
 
<dl class="method">
552
 
<dt id="distutils.ccompiler.CCompiler.add_include_dir">
553
 
<code class="descname">add_include_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_include_dir" title="Permalink to this definition">¶</a></dt>
554
 
<dd><p>Add <em>dir</em> to the list of directories that will be searched for header files.
555
 
The compiler is instructed to search directories in the order in which they are
556
 
supplied by successive calls to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>.</p>
557
 
</dd></dl>
558
 
 
559
 
<dl class="method">
560
 
<dt id="distutils.ccompiler.CCompiler.set_include_dirs">
561
 
<code class="descname">set_include_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_include_dirs" title="Permalink to this definition">¶</a></dt>
562
 
<dd><p>Set the list of directories that will be searched to <em>dirs</em> (a list of strings).
563
 
Overrides any preceding calls to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>; subsequent calls to
564
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a> add to the list passed to <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_include_dirs" title="distutils.ccompiler.CCompiler.set_include_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_include_dirs()</span></code></a>.
565
 
This does not affect any list of standard include directories that the compiler
566
 
may search by default.</p>
567
 
</dd></dl>
568
 
 
569
 
<dl class="method">
570
 
<dt id="distutils.ccompiler.CCompiler.add_library">
571
 
<code class="descname">add_library</code><span class="sig-paren">(</span><em>libname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_library" title="Permalink to this definition">¶</a></dt>
572
 
<dd><p>Add <em>libname</em> to the list of libraries that will be included in all links driven
573
 
by this compiler object.  Note that <em>libname</em> should *not* be the name of a
574
 
file containing a library, but the name of the library itself: the actual
575
 
filename will be inferred by the linker, the compiler, or the compiler class
576
 
(depending on the platform).</p>
577
 
<p>The linker will be instructed to link against libraries in the order they were
578
 
supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>.  It is perfectly
579
 
valid to duplicate library names; the linker will be instructed to link against
580
 
libraries as many times as they are mentioned.</p>
581
 
</dd></dl>
582
 
 
583
 
<dl class="method">
584
 
<dt id="distutils.ccompiler.CCompiler.set_libraries">
585
 
<code class="descname">set_libraries</code><span class="sig-paren">(</span><em>libnames</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_libraries" title="Permalink to this definition">¶</a></dt>
586
 
<dd><p>Set the list of libraries to be included in all links driven by this compiler
587
 
object to <em>libnames</em> (a list of strings).  This does not affect any standard
588
 
system libraries that the linker may include by default.</p>
589
 
</dd></dl>
590
 
 
591
 
<dl class="method">
592
 
<dt id="distutils.ccompiler.CCompiler.add_library_dir">
593
 
<code class="descname">add_library_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_library_dir" title="Permalink to this definition">¶</a></dt>
594
 
<dd><p>Add <em>dir</em> to the list of directories that will be searched for libraries
595
 
specified to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>.  The linker will be
596
 
instructed to search for libraries in the order they are supplied to
597
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library_dir" title="distutils.ccompiler.CCompiler.add_library_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_library_dir()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="distutils.ccompiler.CCompiler.set_library_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_library_dirs()</span></code></a>.</p>
598
 
</dd></dl>
599
 
 
600
 
<dl class="method">
601
 
<dt id="distutils.ccompiler.CCompiler.set_library_dirs">
602
 
<code class="descname">set_library_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="Permalink to this definition">¶</a></dt>
603
 
<dd><p>Set the list of library search directories to <em>dirs</em> (a list of strings).  This
604
 
does not affect any standard library search path that the linker may search by
605
 
default.</p>
606
 
</dd></dl>
607
 
 
608
 
<dl class="method">
609
 
<dt id="distutils.ccompiler.CCompiler.add_runtime_library_dir">
610
 
<code class="descname">add_runtime_library_dir</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_runtime_library_dir" title="Permalink to this definition">¶</a></dt>
611
 
<dd><p>Add <em>dir</em> to the list of directories that will be searched for shared libraries
612
 
at runtime.</p>
613
 
</dd></dl>
614
 
 
615
 
<dl class="method">
616
 
<dt id="distutils.ccompiler.CCompiler.set_runtime_library_dirs">
617
 
<code class="descname">set_runtime_library_dirs</code><span class="sig-paren">(</span><em>dirs</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_runtime_library_dirs" title="Permalink to this definition">¶</a></dt>
618
 
<dd><p>Set the list of directories to search for shared libraries at runtime to <em>dirs</em>
619
 
(a list of strings).  This does not affect any standard search path that the
620
 
runtime linker may search by default.</p>
621
 
</dd></dl>
622
 
 
623
 
<dl class="method">
624
 
<dt id="distutils.ccompiler.CCompiler.define_macro">
625
 
<code class="descname">define_macro</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>value=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.define_macro" title="Permalink to this definition">¶</a></dt>
626
 
<dd><p>Define a preprocessor macro for all compilations driven by this compiler object.
627
 
The optional parameter <em>value</em> should be a string; if it is not supplied, then
628
 
the macro will be defined without an explicit value and the exact outcome
629
 
depends on the compiler used.</p>
630
 
</dd></dl>
631
 
 
632
 
<dl class="method">
633
 
<dt id="distutils.ccompiler.CCompiler.undefine_macro">
634
 
<code class="descname">undefine_macro</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.undefine_macro" title="Permalink to this definition">¶</a></dt>
635
 
<dd><p>Undefine a preprocessor macro for all compilations driven by this compiler
636
 
object.  If the same macro is defined by <a class="reference internal" href="#distutils.ccompiler.CCompiler.define_macro" title="distutils.ccompiler.CCompiler.define_macro"><code class="xref py py-meth docutils literal"><span class="pre">define_macro()</span></code></a> and
637
 
undefined by <a class="reference internal" href="#distutils.ccompiler.CCompiler.undefine_macro" title="distutils.ccompiler.CCompiler.undefine_macro"><code class="xref py py-meth docutils literal"><span class="pre">undefine_macro()</span></code></a> the last call takes precedence
638
 
(including multiple redefinitions or undefinitions).  If the macro is
639
 
redefined/undefined on a per-compilation basis (ie. in the call to
640
 
<a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>), then that takes precedence.</p>
641
 
</dd></dl>
642
 
 
643
 
<dl class="method">
644
 
<dt id="distutils.ccompiler.CCompiler.add_link_object">
645
 
<code class="descname">add_link_object</code><span class="sig-paren">(</span><em>object</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.add_link_object" title="Permalink to this definition">¶</a></dt>
646
 
<dd><p>Add <em>object</em> to the list of object files (or analogues, such as explicitly named
647
 
library files or the output of &#8220;resource compilers&#8221;) to be included in every
648
 
link driven by this compiler object.</p>
649
 
</dd></dl>
650
 
 
651
 
<dl class="method">
652
 
<dt id="distutils.ccompiler.CCompiler.set_link_objects">
653
 
<code class="descname">set_link_objects</code><span class="sig-paren">(</span><em>objects</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_link_objects" title="Permalink to this definition">¶</a></dt>
654
 
<dd><p>Set the list of object files (or analogues) to be included in every link to
655
 
<em>objects</em>.  This does not affect any standard object files that the linker may
656
 
include by default (such as system libraries).</p>
657
 
</dd></dl>
658
 
 
659
 
<p>The following methods implement methods for autodetection of compiler  options,
660
 
providing some functionality similar to GNU <strong class="program">autoconf</strong>.</p>
661
 
<dl class="method">
662
 
<dt id="distutils.ccompiler.CCompiler.detect_language">
663
 
<code class="descname">detect_language</code><span class="sig-paren">(</span><em>sources</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.detect_language" title="Permalink to this definition">¶</a></dt>
664
 
<dd><p>Detect the language of a given file, or list of files. Uses the  instance
665
 
attributes <code class="xref py py-attr docutils literal"><span class="pre">language_map</span></code> (a dictionary), and  <code class="xref py py-attr docutils literal"><span class="pre">language_order</span></code> (a
666
 
list) to do the job.</p>
667
 
</dd></dl>
668
 
 
669
 
<dl class="method">
670
 
<dt id="distutils.ccompiler.CCompiler.find_library_file">
671
 
<code class="descname">find_library_file</code><span class="sig-paren">(</span><em>dirs</em>, <em>lib</em><span class="optional">[</span>, <em>debug=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.find_library_file" title="Permalink to this definition">¶</a></dt>
672
 
<dd><p>Search the specified list of directories for a static or shared library file
673
 
<em>lib</em> and return the full path to that file.  If <em>debug</em> is true, look for a
674
 
debugging version (if that makes sense on the current platform).  Return
675
 
<code class="docutils literal"><span class="pre">None</span></code> if <em>lib</em> wasn&#8217;t found in any of the specified directories.</p>
676
 
</dd></dl>
677
 
 
678
 
<dl class="method">
679
 
<dt id="distutils.ccompiler.CCompiler.has_function">
680
 
<code class="descname">has_function</code><span class="sig-paren">(</span><em>funcname</em><span class="optional">[</span>, <em>includes=None</em>, <em>include_dirs=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.has_function" title="Permalink to this definition">¶</a></dt>
681
 
<dd><p>Return a boolean indicating whether <em>funcname</em> is supported on the current
682
 
platform.  The optional arguments can be used to augment the compilation
683
 
environment by providing additional include files and paths and libraries and
684
 
paths.</p>
685
 
</dd></dl>
686
 
 
687
 
<dl class="method">
688
 
<dt id="distutils.ccompiler.CCompiler.library_dir_option">
689
 
<code class="descname">library_dir_option</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_dir_option" title="Permalink to this definition">¶</a></dt>
690
 
<dd><p>Return the compiler option to add <em>dir</em> to the list of directories searched for
691
 
libraries.</p>
692
 
</dd></dl>
693
 
 
694
 
<dl class="method">
695
 
<dt id="distutils.ccompiler.CCompiler.library_option">
696
 
<code class="descname">library_option</code><span class="sig-paren">(</span><em>lib</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_option" title="Permalink to this definition">¶</a></dt>
697
 
<dd><p>Return the compiler option to add <em>lib</em> to the list of libraries linked into the
698
 
shared library or executable.</p>
699
 
</dd></dl>
700
 
 
701
 
<dl class="method">
702
 
<dt id="distutils.ccompiler.CCompiler.runtime_library_dir_option">
703
 
<code class="descname">runtime_library_dir_option</code><span class="sig-paren">(</span><em>dir</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.runtime_library_dir_option" title="Permalink to this definition">¶</a></dt>
704
 
<dd><p>Return the compiler option to add <em>dir</em> to the list of directories searched for
705
 
runtime libraries.</p>
706
 
</dd></dl>
707
 
 
708
 
<dl class="method">
709
 
<dt id="distutils.ccompiler.CCompiler.set_executables">
710
 
<code class="descname">set_executables</code><span class="sig-paren">(</span><em>**args</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.set_executables" title="Permalink to this definition">¶</a></dt>
711
 
<dd><p>Define the executables (and options for them) that will be run to perform the
712
 
various stages of compilation.  The exact set of executables that may be
713
 
specified here depends on the compiler class (via the &#8216;executables&#8217; class
714
 
attribute), but most will have:</p>
715
 
<table border="1" class="docutils">
716
 
<colgroup>
717
 
<col width="25%" />
718
 
<col width="75%" />
719
 
</colgroup>
720
 
<thead valign="bottom">
721
 
<tr class="row-odd"><th class="head">attribute</th>
722
 
<th class="head">description</th>
723
 
</tr>
724
 
</thead>
725
 
<tbody valign="top">
726
 
<tr class="row-even"><td><em>compiler</em></td>
727
 
<td>the C/C++ compiler</td>
728
 
</tr>
729
 
<tr class="row-odd"><td><em>linker_so</em></td>
730
 
<td>linker used to create shared objects and
731
 
libraries</td>
732
 
</tr>
733
 
<tr class="row-even"><td><em>linker_exe</em></td>
734
 
<td>linker used to create binary executables</td>
735
 
</tr>
736
 
<tr class="row-odd"><td><em>archiver</em></td>
737
 
<td>static library creator</td>
738
 
</tr>
739
 
</tbody>
740
 
</table>
741
 
<p>On platforms with a command-line (Unix, DOS/Windows), each of these is a string
742
 
that will be split into executable name and (optional) list of arguments.
743
 
(Splitting the string is done similarly to how Unix shells operate: words are
744
 
delimited by spaces, but quotes and backslashes can override this.  See
745
 
<a class="reference internal" href="#distutils.util.split_quoted" title="distutils.util.split_quoted"><code class="xref py py-func docutils literal"><span class="pre">distutils.util.split_quoted()</span></code></a>.)</p>
746
 
</dd></dl>
747
 
 
748
 
<p>The following methods invoke stages in the build process.</p>
749
 
<dl class="method">
750
 
<dt id="distutils.ccompiler.CCompiler.compile">
751
 
<code class="descname">compile</code><span class="sig-paren">(</span><em>sources</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>macros=None</em>, <em>include_dirs=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>depends=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.compile" title="Permalink to this definition">¶</a></dt>
752
 
<dd><p>Compile one or more source files. Generates object files (e.g.  transforms a
753
 
<code class="file docutils literal"><span class="pre">.c</span></code> file to a <code class="file docutils literal"><span class="pre">.o</span></code> file.)</p>
754
 
<p><em>sources</em> must be a list of filenames, most likely C/C++ files, but in reality
755
 
anything that can be handled by a particular compiler and compiler class (eg.
756
 
<code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> can handle resource files in <em>sources</em>).  Return a list of
757
 
object filenames, one per source filename in <em>sources</em>.  Depending on the
758
 
implementation, not all source files will necessarily be compiled, but all
759
 
corresponding object filenames will be returned.</p>
760
 
<p>If <em>output_dir</em> is given, object files will be put under it, while retaining
761
 
their original path component.  That is, <code class="file docutils literal"><span class="pre">foo/bar.c</span></code> normally compiles to
762
 
<code class="file docutils literal"><span class="pre">foo/bar.o</span></code> (for a Unix implementation); if <em>output_dir</em> is <em>build</em>, then
763
 
it would compile to <code class="file docutils literal"><span class="pre">build/foo/bar.o</span></code>.</p>
764
 
<p><em>macros</em>, if given, must be a list of macro definitions.  A macro definition is
765
 
either a <code class="docutils literal"><span class="pre">(name,</span> <span class="pre">value)</span></code> 2-tuple or a <code class="docutils literal"><span class="pre">(name,)</span></code> 1-tuple. The former defines
766
 
a macro; if the value is <code class="docutils literal"><span class="pre">None</span></code>, the macro is defined without an explicit
767
 
value.  The 1-tuple case undefines a macro.  Later
768
 
definitions/redefinitions/undefinitions take precedence.</p>
769
 
<p><em>include_dirs</em>, if given, must be a list of strings, the directories to add to
770
 
the default include file search path for this compilation only.</p>
771
 
<p><em>debug</em> is a boolean; if true, the compiler will be instructed to output debug
772
 
symbols in (or alongside) the object file(s).</p>
773
 
<p><em>extra_preargs</em> and <em>extra_postargs</em> are implementation-dependent. On platforms
774
 
that have the notion of a command-line (e.g. Unix, DOS/Windows), they are most
775
 
likely lists of strings: extra command-line arguments to prepend/append to the
776
 
compiler command line.  On other platforms, consult the implementation class
777
 
documentation.  In any event, they are intended as an escape hatch for those
778
 
occasions when the abstract compiler framework doesn&#8217;t cut the mustard.</p>
779
 
<p><em>depends</em>, if given, is a list of filenames that all targets depend on.  If a
780
 
source file is older than any file in depends, then the source file will be
781
 
recompiled.  This supports dependency tracking, but only at a coarse
782
 
granularity.</p>
783
 
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">CompileError</span></code> on failure.</p>
784
 
</dd></dl>
785
 
 
786
 
<dl class="method">
787
 
<dt id="distutils.ccompiler.CCompiler.create_static_lib">
788
 
<code class="descname">create_static_lib</code><span class="sig-paren">(</span><em>objects</em>, <em>output_libname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>debug=0</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.create_static_lib" title="Permalink to this definition">¶</a></dt>
789
 
<dd><p>Link a bunch of stuff together to create a static library file. The &#8220;bunch of
790
 
stuff&#8221; consists of the list of object files supplied as <em>objects</em>, the extra
791
 
object files supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_link_object" title="distutils.ccompiler.CCompiler.add_link_object"><code class="xref py py-meth docutils literal"><span class="pre">add_link_object()</span></code></a> and/or
792
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.set_link_objects" title="distutils.ccompiler.CCompiler.set_link_objects"><code class="xref py py-meth docutils literal"><span class="pre">set_link_objects()</span></code></a>, the libraries supplied to <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library" title="distutils.ccompiler.CCompiler.add_library"><code class="xref py py-meth docutils literal"><span class="pre">add_library()</span></code></a> and/or
793
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.set_libraries" title="distutils.ccompiler.CCompiler.set_libraries"><code class="xref py py-meth docutils literal"><span class="pre">set_libraries()</span></code></a>, and the libraries supplied as <em>libraries</em> (if any).</p>
794
 
<p><em>output_libname</em> should be a library name, not a filename; the filename will be
795
 
inferred from the library name.  <em>output_dir</em> is the directory where the library
796
 
file will be put.</p>
797
 
<p><em>debug</em> is a boolean; if true, debugging information will be included in the
798
 
library (note that on most platforms, it is the compile step where this matters:
799
 
the <em>debug</em> flag is included here just for consistency).</p>
800
 
<p><em>target_lang</em> is the target language for which the given objects are being
801
 
compiled. This allows specific linkage time treatment of certain languages.</p>
802
 
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">LibError</span></code> on failure.</p>
803
 
</dd></dl>
804
 
 
805
 
<dl class="method">
806
 
<dt id="distutils.ccompiler.CCompiler.link">
807
 
<code class="descname">link</code><span class="sig-paren">(</span><em>target_desc</em>, <em>objects</em>, <em>output_filename</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link" title="Permalink to this definition">¶</a></dt>
808
 
<dd><p>Link a bunch of stuff together to create an executable or shared library file.</p>
809
 
<p>The &#8220;bunch of stuff&#8221; consists of the list of object files supplied as <em>objects</em>.
810
 
<em>output_filename</em> should be a filename.  If <em>output_dir</em> is supplied,
811
 
<em>output_filename</em> is relative to it (i.e. <em>output_filename</em> can provide
812
 
directory components if needed).</p>
813
 
<p><em>libraries</em> is a list of libraries to link against.  These are library names,
814
 
not filenames, since they&#8217;re translated into filenames in a platform-specific
815
 
way (eg. <em>foo</em> becomes <code class="file docutils literal"><span class="pre">libfoo.a</span></code> on Unix and <code class="file docutils literal"><span class="pre">foo.lib</span></code> on
816
 
DOS/Windows).  However, they can include a directory component, which means the
817
 
linker will look in that specific directory rather than searching all the normal
818
 
locations.</p>
819
 
<p><em>library_dirs</em>, if supplied, should be a list of directories to search for
820
 
libraries that were specified as bare library names (ie. no directory
821
 
component).  These are on top of the system default and those supplied to
822
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.add_library_dir" title="distutils.ccompiler.CCompiler.add_library_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_library_dir()</span></code></a> and/or <a class="reference internal" href="#distutils.ccompiler.CCompiler.set_library_dirs" title="distutils.ccompiler.CCompiler.set_library_dirs"><code class="xref py py-meth docutils literal"><span class="pre">set_library_dirs()</span></code></a>.  <em>runtime_library_dirs</em>
823
 
is a list of directories that will be embedded into the shared library and used
824
 
to search for other shared libraries that *it* depends on at run-time.  (This
825
 
may only be relevant on Unix.)</p>
826
 
<p><em>export_symbols</em> is a list of symbols that the shared library will export.
827
 
(This appears to be relevant only on Windows.)</p>
828
 
<p><em>debug</em> is as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.create_static_lib" title="distutils.ccompiler.CCompiler.create_static_lib"><code class="xref py py-meth docutils literal"><span class="pre">create_static_lib()</span></code></a>,  with the
829
 
slight distinction that it actually matters on most platforms (as opposed to
830
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler.create_static_lib" title="distutils.ccompiler.CCompiler.create_static_lib"><code class="xref py py-meth docutils literal"><span class="pre">create_static_lib()</span></code></a>, which includes a <em>debug</em> flag mostly for form&#8217;s
831
 
sake).</p>
832
 
<p><em>extra_preargs</em> and <em>extra_postargs</em> are as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>  (except of
833
 
course that they supply command-line arguments for the particular linker being
834
 
used).</p>
835
 
<p><em>target_lang</em> is the target language for which the given objects are being
836
 
compiled. This allows specific linkage time treatment of certain languages.</p>
837
 
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">LinkError</span></code> on failure.</p>
838
 
</dd></dl>
839
 
 
840
 
<dl class="method">
841
 
<dt id="distutils.ccompiler.CCompiler.link_executable">
842
 
<code class="descname">link_executable</code><span class="sig-paren">(</span><em>objects</em>, <em>output_progname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_executable" title="Permalink to this definition">¶</a></dt>
843
 
<dd><p>Link an executable.  <em>output_progname</em> is the name of the file executable, while
844
 
<em>objects</em> are a list of object filenames to link in. Other arguments  are as for
845
 
the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
846
 
</dd></dl>
847
 
 
848
 
<dl class="method">
849
 
<dt id="distutils.ccompiler.CCompiler.link_shared_lib">
850
 
<code class="descname">link_shared_lib</code><span class="sig-paren">(</span><em>objects</em>, <em>output_libname</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_shared_lib" title="Permalink to this definition">¶</a></dt>
851
 
<dd><p>Link a shared library. <em>output_libname</em> is the name of the output  library,
852
 
while <em>objects</em> is a list of object filenames to link in.  Other arguments are
853
 
as for the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
854
 
</dd></dl>
855
 
 
856
 
<dl class="method">
857
 
<dt id="distutils.ccompiler.CCompiler.link_shared_object">
858
 
<code class="descname">link_shared_object</code><span class="sig-paren">(</span><em>objects</em>, <em>output_filename</em><span class="optional">[</span>, <em>output_dir=None</em>, <em>libraries=None</em>, <em>library_dirs=None</em>, <em>runtime_library_dirs=None</em>, <em>export_symbols=None</em>, <em>debug=0</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em>, <em>build_temp=None</em>, <em>target_lang=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.link_shared_object" title="Permalink to this definition">¶</a></dt>
859
 
<dd><p>Link a shared object. <em>output_filename</em> is the name of the shared object that
860
 
will be created, while <em>objects</em> is a list of object filenames  to link in.
861
 
Other arguments are as for the <a class="reference internal" href="#distutils.ccompiler.CCompiler.link" title="distutils.ccompiler.CCompiler.link"><code class="xref py py-meth docutils literal"><span class="pre">link()</span></code></a> method.</p>
862
 
</dd></dl>
863
 
 
864
 
<dl class="method">
865
 
<dt id="distutils.ccompiler.CCompiler.preprocess">
866
 
<code class="descname">preprocess</code><span class="sig-paren">(</span><em>source</em><span class="optional">[</span>, <em>output_file=None</em>, <em>macros=None</em>, <em>include_dirs=None</em>, <em>extra_preargs=None</em>, <em>extra_postargs=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.preprocess" title="Permalink to this definition">¶</a></dt>
867
 
<dd><p>Preprocess a single C/C++ source file, named in <em>source</em>. Output will be written
868
 
to file named <em>output_file</em>, or <em>stdout</em> if <em>output_file</em> not supplied.
869
 
<em>macros</em> is a list of macro definitions as for <a class="reference internal" href="../library/functions.html#compile" title="compile"><code class="xref py py-meth docutils literal"><span class="pre">compile()</span></code></a>, which will
870
 
augment the macros set with <a class="reference internal" href="#distutils.ccompiler.CCompiler.define_macro" title="distutils.ccompiler.CCompiler.define_macro"><code class="xref py py-meth docutils literal"><span class="pre">define_macro()</span></code></a> and <a class="reference internal" href="#distutils.ccompiler.CCompiler.undefine_macro" title="distutils.ccompiler.CCompiler.undefine_macro"><code class="xref py py-meth docutils literal"><span class="pre">undefine_macro()</span></code></a>.
871
 
<em>include_dirs</em> is a list of directory names that will be added to the  default
872
 
list, in the same way as <a class="reference internal" href="#distutils.ccompiler.CCompiler.add_include_dir" title="distutils.ccompiler.CCompiler.add_include_dir"><code class="xref py py-meth docutils literal"><span class="pre">add_include_dir()</span></code></a>.</p>
873
 
<p>Raises <code class="xref py py-exc docutils literal"><span class="pre">PreprocessError</span></code> on failure.</p>
874
 
</dd></dl>
875
 
 
876
 
<p>The following utility methods are defined by the <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> class, for
877
 
use by the various concrete subclasses.</p>
878
 
<dl class="method">
879
 
<dt id="distutils.ccompiler.CCompiler.executable_filename">
880
 
<code class="descname">executable_filename</code><span class="sig-paren">(</span><em>basename</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.executable_filename" title="Permalink to this definition">¶</a></dt>
881
 
<dd><p>Returns the filename of the executable for the given <em>basename</em>.  Typically for
882
 
non-Windows platforms this is the same as the basename,  while Windows will get
883
 
a <code class="file docutils literal"><span class="pre">.exe</span></code> added.</p>
884
 
</dd></dl>
885
 
 
886
 
<dl class="method">
887
 
<dt id="distutils.ccompiler.CCompiler.library_filename">
888
 
<code class="descname">library_filename</code><span class="sig-paren">(</span><em>libname</em><span class="optional">[</span>, <em>lib_type='static'</em>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.library_filename" title="Permalink to this definition">¶</a></dt>
889
 
<dd><p>Returns the filename for the given library name on the current platform. On Unix
890
 
a library with <em>lib_type</em> of <code class="docutils literal"><span class="pre">'static'</span></code> will typically  be of the form
891
 
<code class="file docutils literal"><span class="pre">liblibname.a</span></code>, while a <em>lib_type</em> of <code class="docutils literal"><span class="pre">'dynamic'</span></code>  will be of the form
892
 
<code class="file docutils literal"><span class="pre">liblibname.so</span></code>.</p>
893
 
</dd></dl>
894
 
 
895
 
<dl class="method">
896
 
<dt id="distutils.ccompiler.CCompiler.object_filenames">
897
 
<code class="descname">object_filenames</code><span class="sig-paren">(</span><em>source_filenames</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.object_filenames" title="Permalink to this definition">¶</a></dt>
898
 
<dd><p>Returns the name of the object files for the given source files.
899
 
<em>source_filenames</em> should be a list of filenames.</p>
900
 
</dd></dl>
901
 
 
902
 
<dl class="method">
903
 
<dt id="distutils.ccompiler.CCompiler.shared_object_filename">
904
 
<code class="descname">shared_object_filename</code><span class="sig-paren">(</span><em>basename</em><span class="optional">[</span>, <em>strip_dir=0</em>, <em>output_dir=''</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.shared_object_filename" title="Permalink to this definition">¶</a></dt>
905
 
<dd><p>Returns the name of a shared object file for the given file name <em>basename</em>.</p>
906
 
</dd></dl>
907
 
 
908
 
<dl class="method">
909
 
<dt id="distutils.ccompiler.CCompiler.execute">
910
 
<code class="descname">execute</code><span class="sig-paren">(</span><em>func</em>, <em>args</em><span class="optional">[</span>, <em>msg=None</em>, <em>level=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.execute" title="Permalink to this definition">¶</a></dt>
911
 
<dd><p>Invokes <a class="reference internal" href="#distutils.util.execute" title="distutils.util.execute"><code class="xref py py-func docutils literal"><span class="pre">distutils.util.execute()</span></code></a>. This method invokes a  Python function
912
 
<em>func</em> with the given arguments <em>args</em>, after  logging and taking into account
913
 
the <em>dry_run</em> flag.</p>
914
 
</dd></dl>
915
 
 
916
 
<dl class="method">
917
 
<dt id="distutils.ccompiler.CCompiler.spawn">
918
 
<code class="descname">spawn</code><span class="sig-paren">(</span><em>cmd</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.spawn" title="Permalink to this definition">¶</a></dt>
919
 
<dd><p>Invokes <code class="xref py py-func docutils literal"><span class="pre">distutils.util.spawn()</span></code>. This invokes an external  process to run
920
 
the given command.</p>
921
 
</dd></dl>
922
 
 
923
 
<dl class="method">
924
 
<dt id="distutils.ccompiler.CCompiler.mkpath">
925
 
<code class="descname">mkpath</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>mode=511</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.mkpath" title="Permalink to this definition">¶</a></dt>
926
 
<dd><p>Invokes <a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">distutils.dir_util.mkpath()</span></code></a>. This creates a directory  and any
927
 
missing ancestor directories.</p>
928
 
</dd></dl>
929
 
 
930
 
<dl class="method">
931
 
<dt id="distutils.ccompiler.CCompiler.move_file">
932
 
<code class="descname">move_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.move_file" title="Permalink to this definition">¶</a></dt>
933
 
<dd><p>Invokes <a class="reference internal" href="#distutils.file_util.move_file" title="distutils.file_util.move_file"><code class="xref py py-meth docutils literal"><span class="pre">distutils.file_util.move_file()</span></code></a>. Renames <em>src</em> to  <em>dst</em>.</p>
934
 
</dd></dl>
935
 
 
936
 
<dl class="method">
937
 
<dt id="distutils.ccompiler.CCompiler.announce">
938
 
<code class="descname">announce</code><span class="sig-paren">(</span><em>msg</em><span class="optional">[</span>, <em>level=1</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.announce" title="Permalink to this definition">¶</a></dt>
939
 
<dd><p>Write a message using <code class="xref py py-func docutils literal"><span class="pre">distutils.log.debug()</span></code>.</p>
940
 
</dd></dl>
941
 
 
942
 
<dl class="method">
943
 
<dt id="distutils.ccompiler.CCompiler.warn">
944
 
<code class="descname">warn</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.warn" title="Permalink to this definition">¶</a></dt>
945
 
<dd><p>Write a warning message <em>msg</em> to standard error.</p>
946
 
</dd></dl>
947
 
 
948
 
<dl class="method">
949
 
<dt id="distutils.ccompiler.CCompiler.debug_print">
950
 
<code class="descname">debug_print</code><span class="sig-paren">(</span><em>msg</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.ccompiler.CCompiler.debug_print" title="Permalink to this definition">¶</a></dt>
951
 
<dd><p>If the <em>debug</em> flag is set on this <a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code></a> instance, print  <em>msg</em> to
952
 
standard output, otherwise do nothing.</p>
953
 
</dd></dl>
954
 
 
955
 
</dd></dl>
956
 
 
957
 
</div>
958
 
<div class="section" id="module-distutils.unixccompiler">
959
 
<span id="distutils-unixccompiler-unix-c-compiler"></span><h2>10.3. <a class="reference internal" href="#module-distutils.unixccompiler" title="distutils.unixccompiler: UNIX C Compiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.unixccompiler</span></code></a> &#8212; Unix C Compiler<a class="headerlink" href="#module-distutils.unixccompiler" title="Permalink to this headline">¶</a></h2>
960
 
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code> class, a subclass of
961
 
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> that handles the typical Unix-style command-line  C compiler:</p>
962
 
<ul class="simple">
963
 
<li>macros defined with <code class="xref std std-option docutils literal"><span class="pre">-Dname[=value]</span></code></li>
964
 
<li>macros undefined with <code class="xref std std-option docutils literal"><span class="pre">-Uname</span></code></li>
965
 
<li>include search directories specified with <code class="xref std std-option docutils literal"><span class="pre">-Idir</span></code></li>
966
 
<li>libraries specified with <code class="xref std std-option docutils literal"><span class="pre">-llib</span></code></li>
967
 
<li>library search directories specified with <code class="xref std std-option docutils literal"><span class="pre">-Ldir</span></code></li>
968
 
<li>compile handled by <strong class="program">cc</strong> (or similar) executable with <a class="reference internal" href="../using/cmdline.html#cmdoption-c"><code class="xref std std-option docutils literal"><span class="pre">-c</span></code></a>
969
 
option: compiles <code class="file docutils literal"><span class="pre">.c</span></code> to <code class="file docutils literal"><span class="pre">.o</span></code></li>
970
 
<li>link static library handled by <strong class="program">ar</strong> command (possibly with
971
 
<strong class="program">ranlib</strong>)</li>
972
 
<li>link shared library handled by <strong class="program">cc</strong> <code class="xref std std-option docutils literal"><span class="pre">-shared</span></code></li>
973
 
</ul>
974
 
</div>
975
 
<div class="section" id="module-distutils.msvccompiler">
976
 
<span id="distutils-msvccompiler-microsoft-compiler"></span><h2>10.4. <a class="reference internal" href="#module-distutils.msvccompiler" title="distutils.msvccompiler: Microsoft Compiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.msvccompiler</span></code></a> &#8212; Microsoft Compiler<a class="headerlink" href="#module-distutils.msvccompiler" title="Permalink to this headline">¶</a></h2>
977
 
<p>This module provides <code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code>, an implementation of the abstract
978
 
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> class for Microsoft Visual Studio. Typically, extension
979
 
modules need to be compiled with the same compiler that was used to compile
980
 
Python. For Python 2.3 and earlier, the compiler was Visual Studio 6. For Python
981
 
2.4 and 2.5, the compiler is Visual Studio .NET 2003. The AMD64 and Itanium
982
 
binaries are created using the Platform SDK.</p>
983
 
<p><code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code> will normally choose the right compiler, linker etc. on
984
 
its own. To override this choice, the environment variables <em>DISTUTILS_USE_SDK</em>
985
 
and <em>MSSdk</em> must be both set. <em>MSSdk</em> indicates that the current environment has
986
 
been setup by the SDK&#8217;s <code class="docutils literal"><span class="pre">SetEnv.Cmd</span></code> script, or that the environment variables
987
 
had been registered when the SDK was installed; <em>DISTUTILS_USE_SDK</em> indicates
988
 
that the distutils user has made an explicit choice to override the compiler
989
 
selection by <code class="xref py py-class docutils literal"><span class="pre">MSVCCompiler</span></code>.</p>
990
 
</div>
991
 
<div class="section" id="module-distutils.bcppcompiler">
992
 
<span id="distutils-bcppcompiler-borland-compiler"></span><h2>10.5. <a class="reference internal" href="#module-distutils.bcppcompiler" title="distutils.bcppcompiler"><code class="xref py py-mod docutils literal"><span class="pre">distutils.bcppcompiler</span></code></a> &#8212; Borland Compiler<a class="headerlink" href="#module-distutils.bcppcompiler" title="Permalink to this headline">¶</a></h2>
993
 
<p>This module provides <code class="xref py py-class docutils literal"><span class="pre">BorlandCCompiler</span></code>, an subclass of the abstract
994
 
<code class="xref py py-class docutils literal"><span class="pre">CCompiler</span></code> class for the Borland C++ compiler.</p>
995
 
</div>
996
 
<div class="section" id="module-distutils.cygwinccompiler">
997
 
<span id="distutils-cygwincompiler-cygwin-compiler"></span><h2>10.6. <code class="xref py py-mod docutils literal"><span class="pre">distutils.cygwincompiler</span></code> &#8212; Cygwin Compiler<a class="headerlink" href="#module-distutils.cygwinccompiler" title="Permalink to this headline">¶</a></h2>
998
 
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">CygwinCCompiler</span></code> class, a subclass of
999
 
<code class="xref py py-class docutils literal"><span class="pre">UnixCCompiler</span></code> that handles the Cygwin port of the GNU C compiler to
1000
 
Windows.  It also contains the Mingw32CCompiler class which handles the mingw32
1001
 
port of GCC (same as cygwin in no-cygwin mode).</p>
1002
 
</div>
1003
 
<div class="section" id="module-distutils.archive_util">
1004
 
<span id="distutils-archive-util-archiving-utilities"></span><h2>10.7. <a class="reference internal" href="#module-distutils.archive_util" title="distutils.archive_util: Utility functions for creating archive files (tarballs, zip files, ...)"><code class="xref py py-mod docutils literal"><span class="pre">distutils.archive_util</span></code></a> &#8212;  Archiving utilities<a class="headerlink" href="#module-distutils.archive_util" title="Permalink to this headline">¶</a></h2>
1005
 
<p>This module provides a few functions for creating archive files, such as
1006
 
tarballs or zipfiles.</p>
1007
 
<dl class="function">
1008
 
<dt id="distutils.archive_util.make_archive">
1009
 
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_archive</code><span class="sig-paren">(</span><em>base_name</em>, <em>format</em><span class="optional">[</span>, <em>root_dir=None</em>, <em>base_dir=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_archive" title="Permalink to this definition">¶</a></dt>
1010
 
<dd><p>Create an archive file (eg. <code class="docutils literal"><span class="pre">zip</span></code> or <code class="docutils literal"><span class="pre">tar</span></code>).  <em>base_name</em>  is the name of
1011
 
the file to create, minus any format-specific extension;  <em>format</em> is the
1012
 
archive format: one of <code class="docutils literal"><span class="pre">zip</span></code>, <code class="docutils literal"><span class="pre">tar</span></code>, <code class="docutils literal"><span class="pre">gztar</span></code>, <code class="docutils literal"><span class="pre">bztar</span></code>, <code class="docutils literal"><span class="pre">xztar</span></code>, or
1013
 
<code class="docutils literal"><span class="pre">ztar</span></code>. <em>root_dir</em> is a directory that will be the root directory of the
1014
 
archive; ie. we typically <code class="docutils literal"><span class="pre">chdir</span></code> into <em>root_dir</em> before  creating the
1015
 
archive.  <em>base_dir</em> is the directory where we start  archiving from; ie.
1016
 
<em>base_dir</em> will be the common prefix of all files and directories in the
1017
 
archive.  <em>root_dir</em> and <em>base_dir</em> both default to the current directory.
1018
 
Returns the name of the archive file.</p>
1019
 
</dd></dl>
1020
 
 
1021
 
<dl class="function">
1022
 
<dt id="distutils.archive_util.make_tarball">
1023
 
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_tarball</code><span class="sig-paren">(</span><em>base_name</em>, <em>base_dir</em><span class="optional">[</span>, <em>compress='gzip'</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_tarball" title="Permalink to this definition">¶</a></dt>
1024
 
<dd><p>&#8216;Create an (optional compressed) archive as a tar file from all files in and
1025
 
under <em>base_dir</em>. <em>compress</em> must be <code class="docutils literal"><span class="pre">'gzip'</span></code> (the default),
1026
 
<code class="docutils literal"><span class="pre">'bzip2'</span></code>, <code class="docutils literal"><span class="pre">'xz'</span></code>, <code class="docutils literal"><span class="pre">'compress'</span></code>, or <code class="docutils literal"><span class="pre">None</span></code>.  For the <code class="docutils literal"><span class="pre">'compress'</span></code>
1027
 
method the compression utility named by <strong class="program">compress</strong> must be on the
1028
 
default program search path, so this is probably Unix-specific.  The output
1029
 
tar file will be named <code class="file docutils literal"><span class="pre">base_dir.tar</span></code>, possibly plus the appropriate
1030
 
compression extension (<code class="docutils literal"><span class="pre">.gz</span></code>, <code class="docutils literal"><span class="pre">.bz2</span></code>, <code class="docutils literal"><span class="pre">.xz</span></code> or <code class="docutils literal"><span class="pre">.Z</span></code>).  Return the
1031
 
output filename.</p>
1032
 
</dd></dl>
1033
 
 
1034
 
<dl class="function">
1035
 
<dt id="distutils.archive_util.make_zipfile">
1036
 
<code class="descclassname">distutils.archive_util.</code><code class="descname">make_zipfile</code><span class="sig-paren">(</span><em>base_name</em>, <em>base_dir</em><span class="optional">[</span>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.archive_util.make_zipfile" title="Permalink to this definition">¶</a></dt>
1037
 
<dd><p>Create a zip file from all files in and under <em>base_dir</em>.  The output zip file
1038
 
will be named <em>base_name</em> + <code class="file docutils literal"><span class="pre">.zip</span></code>.  Uses either the  <a class="reference internal" href="../library/zipfile.html#module-zipfile" title="zipfile: Read and write ZIP-format archive files."><code class="xref py py-mod docutils literal"><span class="pre">zipfile</span></code></a> Python
1039
 
module (if available) or the InfoZIP <code class="file docutils literal"><span class="pre">zip</span></code>  utility (if installed and
1040
 
found on the default search path).  If neither  tool is available, raises
1041
 
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsExecError</span></code>.   Returns the name of the output zip file.</p>
1042
 
</dd></dl>
1043
 
 
1044
 
</div>
1045
 
<div class="section" id="module-distutils.dep_util">
1046
 
<span id="distutils-dep-util-dependency-checking"></span><h2>10.8. <a class="reference internal" href="#module-distutils.dep_util" title="distutils.dep_util: Utility functions for simple dependency checking"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dep_util</span></code></a> &#8212; Dependency checking<a class="headerlink" href="#module-distutils.dep_util" title="Permalink to this headline">¶</a></h2>
1047
 
<p>This module provides functions for performing simple, timestamp-based
1048
 
dependency of files and groups of files; also, functions based entirely  on such
1049
 
timestamp dependency analysis.</p>
1050
 
<dl class="function">
1051
 
<dt id="distutils.dep_util.newer">
1052
 
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer</code><span class="sig-paren">(</span><em>source</em>, <em>target</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer" title="Permalink to this definition">¶</a></dt>
1053
 
<dd><p>Return true if <em>source</em> exists and is more recently modified than <em>target</em>, or
1054
 
if <em>source</em> exists and <em>target</em> doesn&#8217;t. Return false if both exist and <em>target</em>
1055
 
is the same age or newer  than <em>source</em>. Raise <code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code> if
1056
 
<em>source</em> does not exist.</p>
1057
 
</dd></dl>
1058
 
 
1059
 
<dl class="function">
1060
 
<dt id="distutils.dep_util.newer_pairwise">
1061
 
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer_pairwise</code><span class="sig-paren">(</span><em>sources</em>, <em>targets</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer_pairwise" title="Permalink to this definition">¶</a></dt>
1062
 
<dd><p>Walk two filename lists in parallel, testing if each source is newer than its
1063
 
corresponding target.  Return a pair of lists (<em>sources</em>, <em>targets</em>) where
1064
 
source is newer than target, according to the semantics of <a class="reference internal" href="#distutils.dep_util.newer" title="distutils.dep_util.newer"><code class="xref py py-func docutils literal"><span class="pre">newer()</span></code></a>.</p>
1065
 
</dd></dl>
1066
 
 
1067
 
<dl class="function">
1068
 
<dt id="distutils.dep_util.newer_group">
1069
 
<code class="descclassname">distutils.dep_util.</code><code class="descname">newer_group</code><span class="sig-paren">(</span><em>sources</em>, <em>target</em><span class="optional">[</span>, <em>missing='error'</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dep_util.newer_group" title="Permalink to this definition">¶</a></dt>
1070
 
<dd><p>Return true if <em>target</em> is out-of-date with respect to any file listed in
1071
 
<em>sources</em>  In other words, if <em>target</em> exists and is newer than every file in
1072
 
<em>sources</em>, return false; otherwise return true. <em>missing</em> controls what we do
1073
 
when a source file is missing; the default (<code class="docutils literal"><span class="pre">'error'</span></code>) is to blow up with an
1074
 
<a class="reference internal" href="../library/exceptions.html#OSError" title="OSError"><code class="xref py py-exc docutils literal"><span class="pre">OSError</span></code></a> from  inside <a class="reference internal" href="../library/os.html#os.stat" title="os.stat"><code class="xref py py-func docutils literal"><span class="pre">os.stat()</span></code></a>; if it is <code class="docutils literal"><span class="pre">'ignore'</span></code>, we silently
1075
 
drop any missing source files; if it is <code class="docutils literal"><span class="pre">'newer'</span></code>, any missing source files
1076
 
make us assume that <em>target</em> is out-of-date (this is handy in &#8220;dry-run&#8221; mode:
1077
 
it&#8217;ll make you pretend to carry out commands that wouldn&#8217;t work because inputs
1078
 
are missing, but that doesn&#8217;t matter because you&#8217;re not actually going to run
1079
 
the commands).</p>
1080
 
</dd></dl>
1081
 
 
1082
 
</div>
1083
 
<div class="section" id="module-distutils.dir_util">
1084
 
<span id="distutils-dir-util-directory-tree-operations"></span><h2>10.9. <a class="reference internal" href="#module-distutils.dir_util" title="distutils.dir_util: Utility functions for operating on directories and directory trees"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dir_util</span></code></a> &#8212; Directory tree operations<a class="headerlink" href="#module-distutils.dir_util" title="Permalink to this headline">¶</a></h2>
1085
 
<p>This module provides functions for operating on directories and trees of
1086
 
directories.</p>
1087
 
<dl class="function">
1088
 
<dt id="distutils.dir_util.mkpath">
1089
 
<code class="descclassname">distutils.dir_util.</code><code class="descname">mkpath</code><span class="sig-paren">(</span><em>name</em><span class="optional">[</span>, <em>mode=0o777</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.mkpath" title="Permalink to this definition">¶</a></dt>
1090
 
<dd><p>Create a directory and any missing ancestor directories.  If the directory
1091
 
already exists (or if <em>name</em> is the empty string, which means the current
1092
 
directory, which of course exists), then do nothing.  Raise
1093
 
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code> if unable to create some directory along the way (eg.
1094
 
some sub-path exists, but is a file rather than a directory).  If <em>verbose</em> is
1095
 
true, print a one-line summary of each mkdir to stdout.  Return the list of
1096
 
directories actually created.</p>
1097
 
</dd></dl>
1098
 
 
1099
 
<dl class="function">
1100
 
<dt id="distutils.dir_util.create_tree">
1101
 
<code class="descclassname">distutils.dir_util.</code><code class="descname">create_tree</code><span class="sig-paren">(</span><em>base_dir</em>, <em>files</em><span class="optional">[</span>, <em>mode=0o777</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.create_tree" title="Permalink to this definition">¶</a></dt>
1102
 
<dd><p>Create all the empty directories under <em>base_dir</em> needed to put <em>files</em> there.
1103
 
<em>base_dir</em> is just the name of a directory which doesn&#8217;t necessarily exist
1104
 
yet; <em>files</em> is a list of filenames to be interpreted relative to <em>base_dir</em>.
1105
 
<em>base_dir</em> + the directory portion of every file in <em>files</em> will be created if
1106
 
it doesn&#8217;t already exist.  <em>mode</em>, <em>verbose</em> and <em>dry_run</em> flags  are as for
1107
 
<a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">mkpath()</span></code></a>.</p>
1108
 
</dd></dl>
1109
 
 
1110
 
<dl class="function">
1111
 
<dt id="distutils.dir_util.copy_tree">
1112
 
<code class="descclassname">distutils.dir_util.</code><code class="descname">copy_tree</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>preserve_mode=1</em>, <em>preserve_times=1</em>, <em>preserve_symlinks=0</em>, <em>update=0</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.copy_tree" title="Permalink to this definition">¶</a></dt>
1113
 
<dd><p>Copy an entire directory tree <em>src</em> to a new location <em>dst</em>.  Both <em>src</em> and
1114
 
<em>dst</em> must be directory names.  If <em>src</em> is not a directory, raise
1115
 
<code class="xref py py-exc docutils literal"><span class="pre">DistutilsFileError</span></code>.  If <em>dst</em> does  not exist, it is created with
1116
 
<a class="reference internal" href="#distutils.dir_util.mkpath" title="distutils.dir_util.mkpath"><code class="xref py py-func docutils literal"><span class="pre">mkpath()</span></code></a>.  The end result of the  copy is that every file in <em>src</em> is
1117
 
copied to <em>dst</em>, and  directories under <em>src</em> are recursively copied to <em>dst</em>.
1118
 
Return the list of files that were copied or might have been copied, using their
1119
 
output name. The return value is unaffected by <em>update</em> or <em>dry_run</em>: it is
1120
 
simply the list of all files under <em>src</em>, with the names changed to be under
1121
 
<em>dst</em>.</p>
1122
 
<p><em>preserve_mode</em> and <em>preserve_times</em> are the same as for
1123
 
<a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">distutils.file_util.copy_file()</span></code></a>; note that they only apply to
1124
 
regular files, not to
1125
 
directories.  If <em>preserve_symlinks</em> is true, symlinks will be copied as
1126
 
symlinks (on platforms that support them!); otherwise (the default), the
1127
 
destination of the symlink will be copied.  <em>update</em> and <em>verbose</em> are the same
1128
 
as for <code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code>.</p>
1129
 
<p>Files in <em>src</em> that begin with <code class="file docutils literal"><span class="pre">.nfs</span></code> are skipped (more information on
1130
 
these files is available in answer D2 of the <a class="reference external" href="http://nfs.sourceforge.net/#section_d">NFS FAQ page</a>).</p>
1131
 
<div class="versionchanged">
1132
 
<p><span class="versionmodified">Changed in version 3.3.1: </span>NFS files are ignored.</p>
1133
 
</div>
1134
 
</dd></dl>
1135
 
 
1136
 
<dl class="function">
1137
 
<dt id="distutils.dir_util.remove_tree">
1138
 
<code class="descclassname">distutils.dir_util.</code><code class="descname">remove_tree</code><span class="sig-paren">(</span><em>directory</em><span class="optional">[</span>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.dir_util.remove_tree" title="Permalink to this definition">¶</a></dt>
1139
 
<dd><p>Recursively remove <em>directory</em> and all files and directories underneath it. Any
1140
 
errors are ignored (apart from being reported to <code class="docutils literal"><span class="pre">sys.stdout</span></code> if <em>verbose</em> is
1141
 
true).</p>
1142
 
</dd></dl>
1143
 
 
1144
 
</div>
1145
 
<div class="section" id="module-distutils.file_util">
1146
 
<span id="distutils-file-util-single-file-operations"></span><h2>10.10. <a class="reference internal" href="#module-distutils.file_util" title="distutils.file_util: Utility functions for operating on single files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.file_util</span></code></a> &#8212; Single file operations<a class="headerlink" href="#module-distutils.file_util" title="Permalink to this headline">¶</a></h2>
1147
 
<p>This module contains some utility functions for operating on individual files.</p>
1148
 
<dl class="function">
1149
 
<dt id="distutils.file_util.copy_file">
1150
 
<code class="descclassname">distutils.file_util.</code><code class="descname">copy_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>preserve_mode=1</em>, <em>preserve_times=1</em>, <em>update=0</em>, <em>link=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.copy_file" title="Permalink to this definition">¶</a></dt>
1151
 
<dd><p>Copy file <em>src</em> to <em>dst</em>. If <em>dst</em> is a directory, then <em>src</em> is copied there
1152
 
with the same name; otherwise, it must be a filename. (If the file exists, it
1153
 
will be ruthlessly clobbered.) If <em>preserve_mode</em> is true (the default), the
1154
 
file&#8217;s mode (type and permission bits, or whatever is analogous on the
1155
 
current platform) is copied. If <em>preserve_times</em> is true (the default), the
1156
 
last-modified and last-access times are copied as well. If <em>update</em> is true,
1157
 
<em>src</em> will only be copied if <em>dst</em> does not exist, or if <em>dst</em> does exist but
1158
 
is older than <em>src</em>.</p>
1159
 
<p><em>link</em> allows you to make hard links (using <a class="reference internal" href="../library/os.html#os.link" title="os.link"><code class="xref py py-func docutils literal"><span class="pre">os.link()</span></code></a>) or symbolic links
1160
 
(using <a class="reference internal" href="../library/os.html#os.symlink" title="os.symlink"><code class="xref py py-func docutils literal"><span class="pre">os.symlink()</span></code></a>) instead of copying: set it to <code class="docutils literal"><span class="pre">'hard'</span></code> or
1161
 
<code class="docutils literal"><span class="pre">'sym'</span></code>; if it is <code class="docutils literal"><span class="pre">None</span></code> (the default), files are copied. Don&#8217;t set <em>link</em>
1162
 
on systems that don&#8217;t support it: <a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code></a> doesn&#8217;t check if hard or
1163
 
symbolic linking is available.  It uses <code class="xref py py-func docutils literal"><span class="pre">_copy_file_contents()</span></code> to copy file
1164
 
contents.</p>
1165
 
<p>Return a tuple <code class="docutils literal"><span class="pre">(dest_name,</span> <span class="pre">copied)</span></code>: <em>dest_name</em> is the actual  name of the
1166
 
output file, and <em>copied</em> is true if the file was copied  (or would have been
1167
 
copied, if <em>dry_run</em> true).</p>
1168
 
</dd></dl>
1169
 
 
1170
 
<dl class="function">
1171
 
<dt id="distutils.file_util.move_file">
1172
 
<code class="descclassname">distutils.file_util.</code><code class="descname">move_file</code><span class="sig-paren">(</span><em>src</em>, <em>dst</em><span class="optional">[</span>, <em>verbose</em>, <em>dry_run</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.move_file" title="Permalink to this definition">¶</a></dt>
1173
 
<dd><p>Move file <em>src</em> to <em>dst</em>. If <em>dst</em> is a directory, the file will be moved into
1174
 
it with the same name; otherwise, <em>src</em> is just renamed to <em>dst</em>.  Returns the
1175
 
new full name of the file.</p>
1176
 
<div class="admonition warning">
1177
 
<p class="first admonition-title">Warning</p>
1178
 
<p class="last">Handles cross-device moves on Unix using <a class="reference internal" href="#distutils.file_util.copy_file" title="distutils.file_util.copy_file"><code class="xref py py-func docutils literal"><span class="pre">copy_file()</span></code></a>.  What about
1179
 
other systems?</p>
1180
 
</div>
1181
 
</dd></dl>
1182
 
 
1183
 
<dl class="function">
1184
 
<dt id="distutils.file_util.write_file">
1185
 
<code class="descclassname">distutils.file_util.</code><code class="descname">write_file</code><span class="sig-paren">(</span><em>filename</em>, <em>contents</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.file_util.write_file" title="Permalink to this definition">¶</a></dt>
1186
 
<dd><p>Create a file called <em>filename</em> and write <em>contents</em> (a sequence of strings
1187
 
without line terminators) to it.</p>
1188
 
</dd></dl>
1189
 
 
1190
 
</div>
1191
 
<div class="section" id="module-distutils.util">
1192
 
<span id="distutils-util-miscellaneous-other-utility-functions"></span><h2>10.11. <a class="reference internal" href="#module-distutils.util" title="distutils.util: Miscellaneous other utility functions"><code class="xref py py-mod docutils literal"><span class="pre">distutils.util</span></code></a> &#8212; Miscellaneous other utility functions<a class="headerlink" href="#module-distutils.util" title="Permalink to this headline">¶</a></h2>
1193
 
<p>This module contains other assorted bits and pieces that don&#8217;t fit into  any
1194
 
other utility module.</p>
1195
 
<dl class="function">
1196
 
<dt id="distutils.util.get_platform">
1197
 
<code class="descclassname">distutils.util.</code><code class="descname">get_platform</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.get_platform" title="Permalink to this definition">¶</a></dt>
1198
 
<dd><p>Return a string that identifies the current platform.  This is used mainly to
1199
 
distinguish platform-specific build directories and platform-specific built
1200
 
distributions.  Typically includes the OS name and version and the architecture
1201
 
(as supplied by &#8216;os.uname()&#8217;), although the exact information included depends
1202
 
on the OS; eg. for IRIX the architecture isn&#8217;t particularly important (IRIX only
1203
 
runs on SGI hardware), but for Linux the kernel version isn&#8217;t particularly
1204
 
important.</p>
1205
 
<p>Examples of returned values:</p>
1206
 
<ul class="simple">
1207
 
<li><code class="docutils literal"><span class="pre">linux-i586</span></code></li>
1208
 
<li><code class="docutils literal"><span class="pre">linux-alpha</span></code></li>
1209
 
<li><code class="docutils literal"><span class="pre">solaris-2.6-sun4u</span></code></li>
1210
 
<li><code class="docutils literal"><span class="pre">irix-5.3</span></code></li>
1211
 
<li><code class="docutils literal"><span class="pre">irix64-6.2</span></code></li>
1212
 
</ul>
1213
 
<p>For non-POSIX platforms, currently just returns <code class="docutils literal"><span class="pre">sys.platform</span></code>.</p>
1214
 
<p>For Mac OS X systems the OS version reflects the minimal version on which
1215
 
binaries will run (that is, the value of <code class="docutils literal"><span class="pre">MACOSX_DEPLOYMENT_TARGET</span></code>
1216
 
during the build of Python), not the OS version of the current system.</p>
1217
 
<p>For universal binary builds on Mac OS X the architecture value reflects
1218
 
the universal binary status instead of the architecture of the current
1219
 
processor. For 32-bit universal binaries the architecture is <code class="docutils literal"><span class="pre">fat</span></code>,
1220
 
for 64-bit universal binaries the architecture is <code class="docutils literal"><span class="pre">fat64</span></code>, and
1221
 
for 4-way universal binaries the architecture is <code class="docutils literal"><span class="pre">universal</span></code>. Starting
1222
 
from Python 2.7 and Python 3.2 the architecture <code class="docutils literal"><span class="pre">fat3</span></code> is used for
1223
 
a 3-way universal build (ppc, i386, x86_64) and <code class="docutils literal"><span class="pre">intel</span></code> is used for
1224
 
a universal build with the i386 and x86_64 architectures</p>
1225
 
<p>Examples of returned values on Mac OS X:</p>
1226
 
<ul class="simple">
1227
 
<li><code class="docutils literal"><span class="pre">macosx-10.3-ppc</span></code></li>
1228
 
<li><code class="docutils literal"><span class="pre">macosx-10.3-fat</span></code></li>
1229
 
<li><code class="docutils literal"><span class="pre">macosx-10.5-universal</span></code></li>
1230
 
<li><code class="docutils literal"><span class="pre">macosx-10.6-intel</span></code></li>
1231
 
</ul>
1232
 
</dd></dl>
1233
 
 
1234
 
<dl class="function">
1235
 
<dt id="distutils.util.convert_path">
1236
 
<code class="descclassname">distutils.util.</code><code class="descname">convert_path</code><span class="sig-paren">(</span><em>pathname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.convert_path" title="Permalink to this definition">¶</a></dt>
1237
 
<dd><p>Return &#8216;pathname&#8217; as a name that will work on the native filesystem, i.e. split
1238
 
it on &#8216;/&#8217; and put it back together again using the current directory separator.
1239
 
Needed because filenames in the setup script are always supplied in Unix style,
1240
 
and have to be converted to the local convention before we can actually use them
1241
 
in the filesystem.  Raises <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> on non-Unix-ish systems if
1242
 
<em>pathname</em> either  starts or ends with a slash.</p>
1243
 
</dd></dl>
1244
 
 
1245
 
<dl class="function">
1246
 
<dt id="distutils.util.change_root">
1247
 
<code class="descclassname">distutils.util.</code><code class="descname">change_root</code><span class="sig-paren">(</span><em>new_root</em>, <em>pathname</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.change_root" title="Permalink to this definition">¶</a></dt>
1248
 
<dd><p>Return <em>pathname</em> with <em>new_root</em> prepended.  If <em>pathname</em> is relative, this is
1249
 
equivalent to <code class="docutils literal"><span class="pre">os.path.join(new_root,pathname)</span></code> Otherwise, it requires making
1250
 
<em>pathname</em> relative and then joining the two, which is tricky on DOS/Windows.</p>
1251
 
</dd></dl>
1252
 
 
1253
 
<dl class="function">
1254
 
<dt id="distutils.util.check_environ">
1255
 
<code class="descclassname">distutils.util.</code><code class="descname">check_environ</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.check_environ" title="Permalink to this definition">¶</a></dt>
1256
 
<dd><p>Ensure that &#8216;os.environ&#8217; has all the environment variables we guarantee that
1257
 
users can use in config files, command-line options, etc.  Currently this
1258
 
includes:</p>
1259
 
<ul class="simple">
1260
 
<li><span class="target" id="index-1"></span><code class="xref std std-envvar docutils literal"><span class="pre">HOME</span></code> - user&#8217;s home directory (Unix only)</li>
1261
 
<li><span class="target" id="index-2"></span><code class="xref std std-envvar docutils literal"><span class="pre">PLAT</span></code> - description of the current platform, including hardware and
1262
 
OS (see <a class="reference internal" href="#distutils.util.get_platform" title="distutils.util.get_platform"><code class="xref py py-func docutils literal"><span class="pre">get_platform()</span></code></a>)</li>
1263
 
</ul>
1264
 
</dd></dl>
1265
 
 
1266
 
<dl class="function">
1267
 
<dt id="distutils.util.subst_vars">
1268
 
<code class="descclassname">distutils.util.</code><code class="descname">subst_vars</code><span class="sig-paren">(</span><em>s</em>, <em>local_vars</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.subst_vars" title="Permalink to this definition">¶</a></dt>
1269
 
<dd><p>Perform shell/Perl-style variable substitution on <em>s</em>.  Every occurrence of
1270
 
<code class="docutils literal"><span class="pre">$</span></code> followed by a name is considered a variable, and variable is substituted
1271
 
by the value found in the <em>local_vars</em> dictionary, or in <code class="docutils literal"><span class="pre">os.environ</span></code> if it&#8217;s
1272
 
not in <em>local_vars</em>. <em>os.environ</em> is first checked/augmented to guarantee that
1273
 
it contains certain values: see <a class="reference internal" href="#distutils.util.check_environ" title="distutils.util.check_environ"><code class="xref py py-func docutils literal"><span class="pre">check_environ()</span></code></a>.  Raise <a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a>
1274
 
for any variables not found in either <em>local_vars</em> or <code class="docutils literal"><span class="pre">os.environ</span></code>.</p>
1275
 
<p>Note that this is not a fully-fledged string interpolation function. A valid
1276
 
<code class="docutils literal"><span class="pre">$variable</span></code> can consist only of upper and lower case letters, numbers and an
1277
 
underscore. No { } or ( ) style quoting is available.</p>
1278
 
</dd></dl>
1279
 
 
1280
 
<dl class="function">
1281
 
<dt id="distutils.util.split_quoted">
1282
 
<code class="descclassname">distutils.util.</code><code class="descname">split_quoted</code><span class="sig-paren">(</span><em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.split_quoted" title="Permalink to this definition">¶</a></dt>
1283
 
<dd><p>Split a string up according to Unix shell-like rules for quotes and backslashes.
1284
 
In short: words are delimited by spaces, as long as those spaces are not escaped
1285
 
by a backslash, or inside a quoted string. Single and double quotes are
1286
 
equivalent, and the quote characters can be backslash-escaped.  The backslash is
1287
 
stripped from any two-character escape sequence, leaving only the escaped
1288
 
character.  The quote characters are stripped from any quoted string.  Returns a
1289
 
list of words.</p>
1290
 
</dd></dl>
1291
 
 
1292
 
<dl class="function">
1293
 
<dt id="distutils.util.execute">
1294
 
<code class="descclassname">distutils.util.</code><code class="descname">execute</code><span class="sig-paren">(</span><em>func</em>, <em>args</em><span class="optional">[</span>, <em>msg=None</em>, <em>verbose=0</em>, <em>dry_run=0</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.execute" title="Permalink to this definition">¶</a></dt>
1295
 
<dd><p>Perform some action that affects the outside world (for instance, writing to the
1296
 
filesystem).  Such actions are special because they are disabled by the
1297
 
<em>dry_run</em> flag.  This method takes  care of all that bureaucracy for you; all
1298
 
you have to do is supply the function to call and an argument tuple for it (to
1299
 
embody the &#8220;external action&#8221; being performed), and an optional message to print.</p>
1300
 
</dd></dl>
1301
 
 
1302
 
<dl class="function">
1303
 
<dt id="distutils.util.strtobool">
1304
 
<code class="descclassname">distutils.util.</code><code class="descname">strtobool</code><span class="sig-paren">(</span><em>val</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.strtobool" title="Permalink to this definition">¶</a></dt>
1305
 
<dd><p>Convert a string representation of truth to true (1) or false (0).</p>
1306
 
<p>True values are <code class="docutils literal"><span class="pre">y</span></code>, <code class="docutils literal"><span class="pre">yes</span></code>, <code class="docutils literal"><span class="pre">t</span></code>, <code class="docutils literal"><span class="pre">true</span></code>, <code class="docutils literal"><span class="pre">on</span></code>  and <code class="docutils literal"><span class="pre">1</span></code>; false values
1307
 
are <code class="docutils literal"><span class="pre">n</span></code>, <code class="docutils literal"><span class="pre">no</span></code>, <code class="docutils literal"><span class="pre">f</span></code>, <code class="docutils literal"><span class="pre">false</span></code>,  <code class="docutils literal"><span class="pre">off</span></code> and <code class="docutils literal"><span class="pre">0</span></code>.  Raises
1308
 
<a class="reference internal" href="../library/exceptions.html#ValueError" title="ValueError"><code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code></a> if <em>val</em>  is anything else.</p>
1309
 
</dd></dl>
1310
 
 
1311
 
<dl class="function">
1312
 
<dt id="distutils.util.byte_compile">
1313
 
<code class="descclassname">distutils.util.</code><code class="descname">byte_compile</code><span class="sig-paren">(</span><em>py_files</em><span class="optional">[</span>, <em>optimize=0</em>, <em>force=0</em>, <em>prefix=None</em>, <em>base_dir=None</em>, <em>verbose=1</em>, <em>dry_run=0</em>, <em>direct=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.byte_compile" title="Permalink to this definition">¶</a></dt>
1314
 
<dd><p>Byte-compile a collection of Python source files to <code class="file docutils literal"><span class="pre">.pyc</span></code> files in a
1315
 
<code class="file docutils literal"><span class="pre">__pycache__</span></code> subdirectory (see <span class="target" id="index-3"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-3147"><strong>PEP 3147</strong></a> and <span class="target" id="index-4"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0488"><strong>PEP 488</strong></a>).
1316
 
<em>py_files</em> is a list of files to compile; any files that don&#8217;t end in
1317
 
<code class="file docutils literal"><span class="pre">.py</span></code> are silently skipped.  <em>optimize</em> must be one of the following:</p>
1318
 
<ul class="simple">
1319
 
<li><code class="docutils literal"><span class="pre">0</span></code> - don&#8217;t optimize</li>
1320
 
<li><code class="docutils literal"><span class="pre">1</span></code> - normal optimization (like <code class="docutils literal"><span class="pre">python</span> <span class="pre">-O</span></code>)</li>
1321
 
<li><code class="docutils literal"><span class="pre">2</span></code> - extra optimization (like <code class="docutils literal"><span class="pre">python</span> <span class="pre">-OO</span></code>)</li>
1322
 
</ul>
1323
 
<p>If <em>force</em> is true, all files are recompiled regardless of timestamps.</p>
1324
 
<p>The source filename encoded in each <a class="reference internal" href="../glossary.html#term-bytecode"><span class="xref std std-term">bytecode</span></a> file defaults to the filenames
1325
 
listed in <em>py_files</em>; you can modify these with <em>prefix</em> and <em>basedir</em>.
1326
 
<em>prefix</em> is a string that will be stripped off of each source filename, and
1327
 
<em>base_dir</em> is a directory name that will be prepended (after <em>prefix</em> is
1328
 
stripped).  You can supply either or both (or neither) of <em>prefix</em> and
1329
 
<em>base_dir</em>, as you wish.</p>
1330
 
<p>If <em>dry_run</em> is true, doesn&#8217;t actually do anything that would affect the
1331
 
filesystem.</p>
1332
 
<p>Byte-compilation is either done directly in this interpreter process with the
1333
 
standard <a class="reference internal" href="../library/py_compile.html#module-py_compile" title="py_compile: Generate byte-code files from Python source files."><code class="xref py py-mod docutils literal"><span class="pre">py_compile</span></code></a> module, or indirectly by writing a temporary script
1334
 
and executing it.  Normally, you should let <a class="reference internal" href="#distutils.util.byte_compile" title="distutils.util.byte_compile"><code class="xref py py-func docutils literal"><span class="pre">byte_compile()</span></code></a> figure out to
1335
 
use direct compilation or not (see the source for details).  The <em>direct</em> flag
1336
 
is used by the script generated in indirect mode; unless you know what you&#8217;re
1337
 
doing, leave it set to <code class="docutils literal"><span class="pre">None</span></code>.</p>
1338
 
<div class="versionchanged">
1339
 
<p><span class="versionmodified">Changed in version 3.2.3: </span>Create <code class="docutils literal"><span class="pre">.pyc</span></code> files with an <a class="reference internal" href="../library/imp.html#imp.get_tag" title="imp.get_tag"><code class="xref py py-func docutils literal"><span class="pre">import</span> <span class="pre">magic</span> <span class="pre">tag</span></code></a> in their name, in a <code class="file docutils literal"><span class="pre">__pycache__</span></code> subdirectory
1340
 
instead of files without tag in the current directory.</p>
1341
 
</div>
1342
 
</dd></dl>
1343
 
 
1344
 
<dl class="function">
1345
 
<dt id="distutils.util.rfc822_escape">
1346
 
<code class="descclassname">distutils.util.</code><code class="descname">rfc822_escape</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.util.rfc822_escape" title="Permalink to this definition">¶</a></dt>
1347
 
<dd><p>Return a version of <em>header</em> escaped for inclusion in an <span class="target" id="index-5"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc822.html"><strong>RFC 822</strong></a> header, by
1348
 
ensuring there are 8 spaces space after each newline. Note that it does no other
1349
 
modification of the string.</p>
1350
 
</dd></dl>
1351
 
 
1352
 
</div>
1353
 
<div class="section" id="module-distutils.dist">
1354
 
<span id="distutils-dist-the-distribution-class"></span><h2>10.12. <a class="reference internal" href="#module-distutils.dist" title="distutils.dist: Provides the Distribution class, which represents the module distribution being built/installed/distributed"><code class="xref py py-mod docutils literal"><span class="pre">distutils.dist</span></code></a> &#8212; The Distribution class<a class="headerlink" href="#module-distutils.dist" title="Permalink to this headline">¶</a></h2>
1355
 
<p>This module provides the <a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> class, which
1356
 
represents the module distribution being built/installed/distributed.</p>
1357
 
</div>
1358
 
<div class="section" id="module-distutils.extension">
1359
 
<span id="distutils-extension-the-extension-class"></span><h2>10.13. <a class="reference internal" href="#module-distutils.extension" title="distutils.extension: Provides the Extension class, used to describe C/C++ extension modules in setup scripts"><code class="xref py py-mod docutils literal"><span class="pre">distutils.extension</span></code></a> &#8212; The Extension class<a class="headerlink" href="#module-distutils.extension" title="Permalink to this headline">¶</a></h2>
1360
 
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">Extension</span></code> class, used to describe C/C++
1361
 
extension modules in setup scripts.</p>
1362
 
</div>
1363
 
<div class="section" id="module-distutils.debug">
1364
 
<span id="distutils-debug-distutils-debug-mode"></span><h2>10.14. <a class="reference internal" href="#module-distutils.debug" title="distutils.debug: Provides the debug flag for distutils"><code class="xref py py-mod docutils literal"><span class="pre">distutils.debug</span></code></a> &#8212; Distutils debug mode<a class="headerlink" href="#module-distutils.debug" title="Permalink to this headline">¶</a></h2>
1365
 
<p>This module provides the DEBUG flag.</p>
1366
 
</div>
1367
 
<div class="section" id="module-distutils.errors">
1368
 
<span id="distutils-errors-distutils-exceptions"></span><h2>10.15. <a class="reference internal" href="#module-distutils.errors" title="distutils.errors: Provides standard distutils exceptions"><code class="xref py py-mod docutils literal"><span class="pre">distutils.errors</span></code></a> &#8212; Distutils exceptions<a class="headerlink" href="#module-distutils.errors" title="Permalink to this headline">¶</a></h2>
1369
 
<p>Provides exceptions used by the Distutils modules.  Note that Distutils modules
1370
 
may raise standard exceptions; in particular, SystemExit is usually raised for
1371
 
errors that are obviously the end-user&#8217;s fault (eg. bad command-line arguments).</p>
1372
 
<p>This module is safe to use in <code class="docutils literal"><span class="pre">from</span> <span class="pre">...</span> <span class="pre">import</span> <span class="pre">*</span></code> mode; it only exports
1373
 
symbols whose names start with <code class="docutils literal"><span class="pre">Distutils</span></code> and end with <code class="docutils literal"><span class="pre">Error</span></code>.</p>
1374
 
</div>
1375
 
<div class="section" id="module-distutils.fancy_getopt">
1376
 
<span id="distutils-fancy-getopt-wrapper-around-the-standard-getopt-module"></span><h2>10.16. <a class="reference internal" href="#module-distutils.fancy_getopt" title="distutils.fancy_getopt: Additional getopt functionality"><code class="xref py py-mod docutils literal"><span class="pre">distutils.fancy_getopt</span></code></a> &#8212; Wrapper around the standard getopt module<a class="headerlink" href="#module-distutils.fancy_getopt" title="Permalink to this headline">¶</a></h2>
1377
 
<p>This module provides a wrapper around the standard <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-mod docutils literal"><span class="pre">getopt</span></code></a>  module that
1378
 
provides the following additional features:</p>
1379
 
<ul class="simple">
1380
 
<li>short and long options are tied together</li>
1381
 
<li>options have help strings, so <a class="reference internal" href="#distutils.fancy_getopt.fancy_getopt" title="distutils.fancy_getopt.fancy_getopt"><code class="xref py py-func docutils literal"><span class="pre">fancy_getopt()</span></code></a> could potentially  create a
1382
 
complete usage summary</li>
1383
 
<li>options set attributes of a passed-in object</li>
1384
 
<li>boolean options can have &#8220;negative aliases&#8221; &#8212; eg. if <code class="xref std std-option docutils literal"><span class="pre">--quiet</span></code> is
1385
 
the &#8220;negative alias&#8221; of <a class="reference internal" href="../library/tarfile.html#cmdoption--verbose"><code class="xref std std-option docutils literal"><span class="pre">--verbose</span></code></a>, then <code class="xref std std-option docutils literal"><span class="pre">--quiet</span></code> on the
1386
 
command line sets <em>verbose</em> to false.</li>
1387
 
</ul>
1388
 
<dl class="function">
1389
 
<dt id="distutils.fancy_getopt.fancy_getopt">
1390
 
<code class="descclassname">distutils.fancy_getopt.</code><code class="descname">fancy_getopt</code><span class="sig-paren">(</span><em>options</em>, <em>negative_opt</em>, <em>object</em>, <em>args</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.fancy_getopt" title="Permalink to this definition">¶</a></dt>
1391
 
<dd><p>Wrapper function. <em>options</em> is a list of <code class="docutils literal"><span class="pre">(long_option,</span> <span class="pre">short_option,</span>
1392
 
<span class="pre">help_string)</span></code> 3-tuples as described in the constructor for
1393
 
<a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a>. <em>negative_opt</em> should be a dictionary mapping option names
1394
 
to option names, both the key and value should be in the <em>options</em> list.
1395
 
<em>object</em> is an object which will be used to store values (see the <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a>
1396
 
method of the <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> class). <em>args</em> is the argument list. Will use
1397
 
<code class="docutils literal"><span class="pre">sys.argv[1:]</span></code> if you  pass <code class="docutils literal"><span class="pre">None</span></code> as <em>args</em>.</p>
1398
 
</dd></dl>
1399
 
 
1400
 
<dl class="function">
1401
 
<dt id="distutils.fancy_getopt.wrap_text">
1402
 
<code class="descclassname">distutils.fancy_getopt.</code><code class="descname">wrap_text</code><span class="sig-paren">(</span><em>text</em>, <em>width</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.wrap_text" title="Permalink to this definition">¶</a></dt>
1403
 
<dd><p>Wraps <em>text</em> to less than <em>width</em> wide.</p>
1404
 
</dd></dl>
1405
 
 
1406
 
<dl class="class">
1407
 
<dt id="distutils.fancy_getopt.FancyGetopt">
1408
 
<em class="property">class </em><code class="descclassname">distutils.fancy_getopt.</code><code class="descname">FancyGetopt</code><span class="sig-paren">(</span><span class="optional">[</span><em>option_table=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt" title="Permalink to this definition">¶</a></dt>
1409
 
<dd><p>The option_table is a list of 3-tuples: <code class="docutils literal"><span class="pre">(long_option,</span> <span class="pre">short_option,</span>
1410
 
<span class="pre">help_string)</span></code></p>
1411
 
<p>If an option takes an argument, its <em>long_option</em> should have <code class="docutils literal"><span class="pre">'='</span></code> appended;
1412
 
<em>short_option</em> should just be a single character, no <code class="docutils literal"><span class="pre">':'</span></code> in any case.
1413
 
<em>short_option</em> should be <code class="docutils literal"><span class="pre">None</span></code> if a <em>long_option</em>  doesn&#8217;t have a
1414
 
corresponding <em>short_option</em>. All option tuples must have long options.</p>
1415
 
</dd></dl>
1416
 
 
1417
 
<p>The <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> class provides the following methods:</p>
1418
 
<dl class="method">
1419
 
<dt id="distutils.fancy_getopt.FancyGetopt.getopt">
1420
 
<code class="descclassname">FancyGetopt.</code><code class="descname">getopt</code><span class="sig-paren">(</span><span class="optional">[</span><em>args=None</em>, <em>object=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.getopt" title="Permalink to this definition">¶</a></dt>
1421
 
<dd><p>Parse command-line options in args. Store as attributes on <em>object</em>.</p>
1422
 
<p>If <em>args</em> is <code class="docutils literal"><span class="pre">None</span></code> or not supplied, uses <code class="docutils literal"><span class="pre">sys.argv[1:]</span></code>.  If <em>object</em> is
1423
 
<code class="docutils literal"><span class="pre">None</span></code> or not supplied, creates a new <code class="xref py py-class docutils literal"><span class="pre">OptionDummy</span></code> instance, stores
1424
 
option values there, and returns a tuple <code class="docutils literal"><span class="pre">(args,</span> <span class="pre">object)</span></code>.  If <em>object</em> is
1425
 
supplied, it is modified in place and <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-func docutils literal"><span class="pre">getopt()</span></code></a> just returns <em>args</em>; in
1426
 
both cases, the returned <em>args</em> is a modified copy of the passed-in <em>args</em> list,
1427
 
which is left untouched.</p>
1428
 
</dd></dl>
1429
 
 
1430
 
<dl class="method">
1431
 
<dt id="distutils.fancy_getopt.FancyGetopt.get_option_order">
1432
 
<code class="descclassname">FancyGetopt.</code><code class="descname">get_option_order</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.get_option_order" title="Permalink to this definition">¶</a></dt>
1433
 
<dd><p>Returns the list of <code class="docutils literal"><span class="pre">(option,</span> <span class="pre">value)</span></code> tuples processed by the previous run of
1434
 
<a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a>  Raises <a class="reference internal" href="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> if <a class="reference internal" href="../library/getopt.html#module-getopt" title="getopt: Portable parser for command line options; support both short and long option names."><code class="xref py py-meth docutils literal"><span class="pre">getopt()</span></code></a> hasn&#8217;t been called
1435
 
yet.</p>
1436
 
</dd></dl>
1437
 
 
1438
 
<dl class="method">
1439
 
<dt id="distutils.fancy_getopt.FancyGetopt.generate_help">
1440
 
<code class="descclassname">FancyGetopt.</code><code class="descname">generate_help</code><span class="sig-paren">(</span><span class="optional">[</span><em>header=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.fancy_getopt.FancyGetopt.generate_help" title="Permalink to this definition">¶</a></dt>
1441
 
<dd><p>Generate help text (a list of strings, one per suggested line of output) from
1442
 
the option table for this <a class="reference internal" href="#distutils.fancy_getopt.FancyGetopt" title="distutils.fancy_getopt.FancyGetopt"><code class="xref py py-class docutils literal"><span class="pre">FancyGetopt</span></code></a> object.</p>
1443
 
<p>If supplied, prints the supplied <em>header</em> at the top of the help.</p>
1444
 
</dd></dl>
1445
 
 
1446
 
</div>
1447
 
<div class="section" id="module-distutils.filelist">
1448
 
<span id="distutils-filelist-the-filelist-class"></span><h2>10.17. <a class="reference internal" href="#module-distutils.filelist" title="distutils.filelist: The FileList class, used for poking about the file system and building lists of files."><code class="xref py py-mod docutils literal"><span class="pre">distutils.filelist</span></code></a> &#8212; The FileList class<a class="headerlink" href="#module-distutils.filelist" title="Permalink to this headline">¶</a></h2>
1449
 
<p>This module provides the <code class="xref py py-class docutils literal"><span class="pre">FileList</span></code> class, used for poking about the
1450
 
filesystem and building lists of files.</p>
1451
 
</div>
1452
 
<div class="section" id="module-distutils.log">
1453
 
<span id="distutils-log-simple-pep-282-style-logging"></span><h2>10.18. <a class="reference internal" href="#module-distutils.log" title="distutils.log: A simple logging mechanism, 282-style"><code class="xref py py-mod docutils literal"><span class="pre">distutils.log</span></code></a> &#8212; Simple PEP 282-style logging<a class="headerlink" href="#module-distutils.log" title="Permalink to this headline">¶</a></h2>
1454
 
</div>
1455
 
<div class="section" id="module-distutils.spawn">
1456
 
<span id="distutils-spawn-spawn-a-sub-process"></span><h2>10.19. <a class="reference internal" href="#module-distutils.spawn" title="distutils.spawn: Provides the spawn() function"><code class="xref py py-mod docutils literal"><span class="pre">distutils.spawn</span></code></a> &#8212; Spawn a sub-process<a class="headerlink" href="#module-distutils.spawn" title="Permalink to this headline">¶</a></h2>
1457
 
<p>This module provides the <code class="xref py py-func docutils literal"><span class="pre">spawn()</span></code> function, a front-end to  various
1458
 
platform-specific functions for launching another program in a  sub-process.
1459
 
Also provides <code class="xref py py-func docutils literal"><span class="pre">find_executable()</span></code> to search the path for a given executable
1460
 
name.</p>
1461
 
</div>
1462
 
<div class="section" id="module-distutils.sysconfig">
1463
 
<span id="distutils-sysconfig-system-configuration-information"></span><h2>10.20. <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> &#8212; System configuration information<a class="headerlink" href="#module-distutils.sysconfig" title="Permalink to this headline">¶</a></h2>
1464
 
<p>The <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> module provides access to Python&#8217;s low-level
1465
 
configuration information.  The specific configuration variables available
1466
 
depend heavily on the platform and configuration. The specific variables depend
1467
 
on the build process for the specific version of Python being run; the variables
1468
 
are those found in the <code class="file docutils literal"><span class="pre">Makefile</span></code> and configuration header that are
1469
 
installed with Python on Unix systems.  The configuration header is called
1470
 
<code class="file docutils literal"><span class="pre">pyconfig.h</span></code> for Python versions starting with 2.2, and <code class="file docutils literal"><span class="pre">config.h</span></code>
1471
 
for earlier versions of Python.</p>
1472
 
<p>Some additional functions are provided which perform some useful manipulations
1473
 
for other parts of the <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a> package.</p>
1474
 
<dl class="data">
1475
 
<dt id="distutils.sysconfig.PREFIX">
1476
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">PREFIX</code><a class="headerlink" href="#distutils.sysconfig.PREFIX" title="Permalink to this definition">¶</a></dt>
1477
 
<dd><p>The result of <code class="docutils literal"><span class="pre">os.path.normpath(sys.prefix)</span></code>.</p>
1478
 
</dd></dl>
1479
 
 
1480
 
<dl class="data">
1481
 
<dt id="distutils.sysconfig.EXEC_PREFIX">
1482
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">EXEC_PREFIX</code><a class="headerlink" href="#distutils.sysconfig.EXEC_PREFIX" title="Permalink to this definition">¶</a></dt>
1483
 
<dd><p>The result of <code class="docutils literal"><span class="pre">os.path.normpath(sys.exec_prefix)</span></code>.</p>
1484
 
</dd></dl>
1485
 
 
1486
 
<dl class="function">
1487
 
<dt id="distutils.sysconfig.get_config_var">
1488
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_var</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_var" title="Permalink to this definition">¶</a></dt>
1489
 
<dd><p>Return the value of a single variable.  This is equivalent to
1490
 
<code class="docutils literal"><span class="pre">get_config_vars().get(name)</span></code>.</p>
1491
 
</dd></dl>
1492
 
 
1493
 
<dl class="function">
1494
 
<dt id="distutils.sysconfig.get_config_vars">
1495
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_vars</code><span class="sig-paren">(</span><em>...</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_vars" title="Permalink to this definition">¶</a></dt>
1496
 
<dd><p>Return a set of variable definitions.  If there are no arguments, this returns a
1497
 
dictionary mapping names of configuration variables to values.  If arguments are
1498
 
provided, they should be strings, and the return value will be a sequence giving
1499
 
the associated values. If a given name does not have a corresponding value,
1500
 
<code class="docutils literal"><span class="pre">None</span></code> will be included for that variable.</p>
1501
 
</dd></dl>
1502
 
 
1503
 
<dl class="function">
1504
 
<dt id="distutils.sysconfig.get_config_h_filename">
1505
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_config_h_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_config_h_filename" title="Permalink to this definition">¶</a></dt>
1506
 
<dd><p>Return the full path name of the configuration header.  For Unix, this will be
1507
 
the header generated by the <strong class="program">configure</strong> script; for other platforms the
1508
 
header will have been supplied directly by the Python source distribution.  The
1509
 
file is a platform-specific text file.</p>
1510
 
</dd></dl>
1511
 
 
1512
 
<dl class="function">
1513
 
<dt id="distutils.sysconfig.get_makefile_filename">
1514
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_makefile_filename</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_makefile_filename" title="Permalink to this definition">¶</a></dt>
1515
 
<dd><p>Return the full path name of the <code class="file docutils literal"><span class="pre">Makefile</span></code> used to build Python.  For
1516
 
Unix, this will be a file generated by the <strong class="program">configure</strong> script; the
1517
 
meaning for other platforms will vary.  The file is a platform-specific text
1518
 
file, if it exists. This function is only useful on POSIX platforms.</p>
1519
 
</dd></dl>
1520
 
 
1521
 
<dl class="function">
1522
 
<dt id="distutils.sysconfig.get_python_inc">
1523
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_python_inc</code><span class="sig-paren">(</span><span class="optional">[</span><em>plat_specific</em><span class="optional">[</span>, <em>prefix</em><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_python_inc" title="Permalink to this definition">¶</a></dt>
1524
 
<dd><p>Return the directory for either the general or platform-dependent C include
1525
 
files.  If <em>plat_specific</em> is true, the platform-dependent include directory is
1526
 
returned; if false or omitted, the platform-independent directory is returned.
1527
 
If <em>prefix</em> is given, it is used as either the prefix instead of
1528
 
<a class="reference internal" href="#distutils.sysconfig.PREFIX" title="distutils.sysconfig.PREFIX"><code class="xref py py-const docutils literal"><span class="pre">PREFIX</span></code></a>, or as the exec-prefix instead of <a class="reference internal" href="#distutils.sysconfig.EXEC_PREFIX" title="distutils.sysconfig.EXEC_PREFIX"><code class="xref py py-const docutils literal"><span class="pre">EXEC_PREFIX</span></code></a> if
1529
 
<em>plat_specific</em> is true.</p>
1530
 
</dd></dl>
1531
 
 
1532
 
<dl class="function">
1533
 
<dt id="distutils.sysconfig.get_python_lib">
1534
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">get_python_lib</code><span class="sig-paren">(</span><span class="optional">[</span><em>plat_specific</em><span class="optional">[</span>, <em>standard_lib</em><span class="optional">[</span>, <em>prefix</em><span class="optional">]</span><span class="optional">]</span><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.get_python_lib" title="Permalink to this definition">¶</a></dt>
1535
 
<dd><p>Return the directory for either the general or platform-dependent library
1536
 
installation.  If <em>plat_specific</em> is true, the platform-dependent include
1537
 
directory is returned; if false or omitted, the platform-independent directory
1538
 
is returned.  If <em>prefix</em> is given, it is used as either the prefix instead of
1539
 
<a class="reference internal" href="#distutils.sysconfig.PREFIX" title="distutils.sysconfig.PREFIX"><code class="xref py py-const docutils literal"><span class="pre">PREFIX</span></code></a>, or as the exec-prefix instead of <a class="reference internal" href="#distutils.sysconfig.EXEC_PREFIX" title="distutils.sysconfig.EXEC_PREFIX"><code class="xref py py-const docutils literal"><span class="pre">EXEC_PREFIX</span></code></a> if
1540
 
<em>plat_specific</em> is true.  If <em>standard_lib</em> is true, the directory for the
1541
 
standard library is returned rather than the directory for the installation of
1542
 
third-party extensions.</p>
1543
 
</dd></dl>
1544
 
 
1545
 
<p>The following function is only intended for use within the <a class="reference internal" href="../library/distutils.html#module-distutils" title="distutils: Support for building and installing Python modules into an existing Python installation."><code class="xref py py-mod docutils literal"><span class="pre">distutils</span></code></a>
1546
 
package.</p>
1547
 
<dl class="function">
1548
 
<dt id="distutils.sysconfig.customize_compiler">
1549
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">customize_compiler</code><span class="sig-paren">(</span><em>compiler</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.customize_compiler" title="Permalink to this definition">¶</a></dt>
1550
 
<dd><p>Do any platform-specific customization of a
1551
 
<a class="reference internal" href="#distutils.ccompiler.CCompiler" title="distutils.ccompiler.CCompiler"><code class="xref py py-class docutils literal"><span class="pre">distutils.ccompiler.CCompiler</span></code></a> instance.</p>
1552
 
<p>This function is only needed on Unix at this time, but should be called
1553
 
consistently to support forward-compatibility.  It inserts the information that
1554
 
varies across Unix flavors and is stored in Python&#8217;s <code class="file docutils literal"><span class="pre">Makefile</span></code>.  This
1555
 
information includes the selected compiler, compiler and linker options, and the
1556
 
extension used by the linker for shared objects.</p>
1557
 
</dd></dl>
1558
 
 
1559
 
<p>This function is even more special-purpose, and should only be used from
1560
 
Python&#8217;s own build procedures.</p>
1561
 
<dl class="function">
1562
 
<dt id="distutils.sysconfig.set_python_build">
1563
 
<code class="descclassname">distutils.sysconfig.</code><code class="descname">set_python_build</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.sysconfig.set_python_build" title="Permalink to this definition">¶</a></dt>
1564
 
<dd><p>Inform the <a class="reference internal" href="#module-distutils.sysconfig" title="distutils.sysconfig: Low-level access to configuration information of the Python interpreter."><code class="xref py py-mod docutils literal"><span class="pre">distutils.sysconfig</span></code></a> module that it is being used as part of
1565
 
the build process for Python.  This changes a lot of relative locations for
1566
 
files, allowing them to be located in the build area rather than in an installed
1567
 
Python.</p>
1568
 
</dd></dl>
1569
 
 
1570
 
</div>
1571
 
<div class="section" id="module-distutils.text_file">
1572
 
<span id="distutils-text-file-the-textfile-class"></span><h2>10.21. <a class="reference internal" href="#module-distutils.text_file" title="distutils.text_file: provides the TextFile class, a simple interface to text files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.text_file</span></code></a> &#8212; The TextFile class<a class="headerlink" href="#module-distutils.text_file" title="Permalink to this headline">¶</a></h2>
1573
 
<p>This module provides the <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> class, which gives an interface  to
1574
 
text files that (optionally) takes care of stripping comments, ignoring  blank
1575
 
lines, and joining lines with backslashes.</p>
1576
 
<dl class="class">
1577
 
<dt id="distutils.text_file.TextFile">
1578
 
<em class="property">class </em><code class="descclassname">distutils.text_file.</code><code class="descname">TextFile</code><span class="sig-paren">(</span><span class="optional">[</span><em>filename=None</em>, <em>file=None</em>, <em>**options</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile" title="Permalink to this definition">¶</a></dt>
1579
 
<dd><p>This class provides a file-like object that takes care of all  the things you
1580
 
commonly want to do when processing a text file  that has some line-by-line
1581
 
syntax: strip comments (as long as <code class="docutils literal"><span class="pre">#</span></code>  is your comment character), skip blank
1582
 
lines, join adjacent lines by escaping the newline (ie. backslash at end of
1583
 
line), strip leading and/or trailing whitespace.  All of these are optional and
1584
 
independently controllable.</p>
1585
 
<p>The class provides a <a class="reference internal" href="#distutils.text_file.TextFile.warn" title="distutils.text_file.TextFile.warn"><code class="xref py py-meth docutils literal"><span class="pre">warn()</span></code></a> method so you can generate  warning messages
1586
 
that report physical line number, even if the  logical line in question spans
1587
 
multiple physical lines.  Also  provides <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> for implementing
1588
 
line-at-a-time lookahead.</p>
1589
 
<p><a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> instances are create with either <em>filename</em>, <em>file</em>, or both.
1590
 
<a class="reference internal" href="../library/exceptions.html#RuntimeError" title="RuntimeError"><code class="xref py py-exc docutils literal"><span class="pre">RuntimeError</span></code></a> is raised if both are <code class="docutils literal"><span class="pre">None</span></code>. <em>filename</em> should be a
1591
 
string, and <em>file</em> a file object (or something that provides <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>
1592
 
and <a class="reference internal" href="#distutils.text_file.TextFile.close" title="distutils.text_file.TextFile.close"><code class="xref py py-meth docutils literal"><span class="pre">close()</span></code></a>  methods).  It is recommended that you supply at least
1593
 
<em>filename</em>,  so that <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> can include it in warning messages.  If
1594
 
<em>file</em> is not supplied, <a class="reference internal" href="#distutils.text_file.TextFile" title="distutils.text_file.TextFile"><code class="xref py py-class docutils literal"><span class="pre">TextFile</span></code></a> creates its own using the
1595
 
<a class="reference internal" href="../library/functions.html#open" title="open"><code class="xref py py-func docutils literal"><span class="pre">open()</span></code></a> built-in function.</p>
1596
 
<p>The options are all boolean, and affect the values returned by <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a></p>
1597
 
<table border="1" class="docutils">
1598
 
<colgroup>
1599
 
<col width="31%" />
1600
 
<col width="54%" />
1601
 
<col width="15%" />
1602
 
</colgroup>
1603
 
<thead valign="bottom">
1604
 
<tr class="row-odd"><th class="head">option name</th>
1605
 
<th class="head">description</th>
1606
 
<th class="head">default</th>
1607
 
</tr>
1608
 
</thead>
1609
 
<tbody valign="top">
1610
 
<tr class="row-even"><td><em>strip_comments</em></td>
1611
 
<td>strip from <code class="docutils literal"><span class="pre">'#'</span></code> to end-of-
1612
 
line, as well as any
1613
 
whitespace leading up to the
1614
 
<code class="docutils literal"><span class="pre">'#'</span></code>&#8212;unless it is
1615
 
escaped by a backslash</td>
1616
 
<td>true</td>
1617
 
</tr>
1618
 
<tr class="row-odd"><td><em>lstrip_ws</em></td>
1619
 
<td>strip leading whitespace from
1620
 
each line before returning it</td>
1621
 
<td>false</td>
1622
 
</tr>
1623
 
<tr class="row-even"><td><em>rstrip_ws</em></td>
1624
 
<td>strip trailing whitespace
1625
 
(including line terminator!)
1626
 
from each line before
1627
 
returning it.</td>
1628
 
<td>true</td>
1629
 
</tr>
1630
 
<tr class="row-odd"><td><em>skip_blanks</em></td>
1631
 
<td>skip lines that are empty
1632
 
*after* stripping comments
1633
 
and whitespace.  (If both
1634
 
lstrip_ws and rstrip_ws are
1635
 
false, then some lines may
1636
 
consist of solely whitespace:
1637
 
these will *not* be skipped,
1638
 
even if <em>skip_blanks</em> is
1639
 
true.)</td>
1640
 
<td>true</td>
1641
 
</tr>
1642
 
<tr class="row-even"><td><em>join_lines</em></td>
1643
 
<td>if a backslash is the last
1644
 
non-newline character on a
1645
 
line after stripping comments
1646
 
and whitespace, join the
1647
 
following line to it to form
1648
 
one logical line; if N
1649
 
consecutive lines end with a
1650
 
backslash, then N+1 physical
1651
 
lines will be joined to form
1652
 
one logical line.</td>
1653
 
<td>false</td>
1654
 
</tr>
1655
 
<tr class="row-odd"><td><em>collapse_join</em></td>
1656
 
<td>strip leading whitespace from
1657
 
lines that are joined to their
1658
 
predecessor; only matters if
1659
 
<code class="docutils literal"><span class="pre">(join_lines</span> <span class="pre">and</span> <span class="pre">not</span>
1660
 
<span class="pre">lstrip_ws)</span></code></td>
1661
 
<td>false</td>
1662
 
</tr>
1663
 
</tbody>
1664
 
</table>
1665
 
<p>Note that since <em>rstrip_ws</em> can strip the trailing newline, the semantics of
1666
 
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> must differ from those of the built-in file object&#8217;s
1667
 
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> method!  In particular, <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>  returns <code class="docutils literal"><span class="pre">None</span></code> for
1668
 
end-of-file: an empty string might just be a  blank line (or an all-whitespace
1669
 
line), if <em>rstrip_ws</em> is true  but <em>skip_blanks</em> is not.</p>
1670
 
<dl class="method">
1671
 
<dt id="distutils.text_file.TextFile.open">
1672
 
<code class="descname">open</code><span class="sig-paren">(</span><em>filename</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.open" title="Permalink to this definition">¶</a></dt>
1673
 
<dd><p>Open a new file <em>filename</em>.  This overrides any <em>file</em> or <em>filename</em>
1674
 
constructor arguments.</p>
1675
 
</dd></dl>
1676
 
 
1677
 
<dl class="method">
1678
 
<dt id="distutils.text_file.TextFile.close">
1679
 
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.close" title="Permalink to this definition">¶</a></dt>
1680
 
<dd><p>Close the current file and forget everything we know about it (including the
1681
 
filename and the current line number).</p>
1682
 
</dd></dl>
1683
 
 
1684
 
<dl class="method">
1685
 
<dt id="distutils.text_file.TextFile.warn">
1686
 
<code class="descname">warn</code><span class="sig-paren">(</span><em>msg</em><span class="optional">[</span>, <em>line=None</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.warn" title="Permalink to this definition">¶</a></dt>
1687
 
<dd><p>Print (to stderr) a warning message tied to the current logical line in the
1688
 
current file.  If the current logical line in the file spans multiple physical
1689
 
lines, the warning refers to the whole range, such as <code class="docutils literal"><span class="pre">&quot;lines</span> <span class="pre">3-5&quot;</span></code>.  If
1690
 
<em>line</em> is supplied,  it overrides the current line number; it may be a list or
1691
 
tuple  to indicate a range of physical lines, or an integer for a  single
1692
 
physical line.</p>
1693
 
</dd></dl>
1694
 
 
1695
 
<dl class="method">
1696
 
<dt id="distutils.text_file.TextFile.readline">
1697
 
<code class="descname">readline</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.readline" title="Permalink to this definition">¶</a></dt>
1698
 
<dd><p>Read and return a single logical line from the current file (or from an internal
1699
 
buffer if lines have previously been &#8220;unread&#8221; with <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a>).  If the
1700
 
<em>join_lines</em> option  is true, this may involve reading multiple physical lines
1701
 
concatenated into a single string.  Updates the current line number,  so calling
1702
 
<a class="reference internal" href="#distutils.text_file.TextFile.warn" title="distutils.text_file.TextFile.warn"><code class="xref py py-meth docutils literal"><span class="pre">warn()</span></code></a> after <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> emits a warning  about the physical line(s)
1703
 
just read.  Returns <code class="docutils literal"><span class="pre">None</span></code> on end-of-file,  since the empty string can occur
1704
 
if <em>rstrip_ws</em> is true but  <em>strip_blanks</em> is not.</p>
1705
 
</dd></dl>
1706
 
 
1707
 
<dl class="method">
1708
 
<dt id="distutils.text_file.TextFile.readlines">
1709
 
<code class="descname">readlines</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.readlines" title="Permalink to this definition">¶</a></dt>
1710
 
<dd><p>Read and return the list of all logical lines remaining in the current file.
1711
 
This updates the current line number to the last line of the file.</p>
1712
 
</dd></dl>
1713
 
 
1714
 
<dl class="method">
1715
 
<dt id="distutils.text_file.TextFile.unreadline">
1716
 
<code class="descname">unreadline</code><span class="sig-paren">(</span><em>line</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.text_file.TextFile.unreadline" title="Permalink to this definition">¶</a></dt>
1717
 
<dd><p>Push <em>line</em> (a string) onto an internal buffer that will be checked by future
1718
 
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a> calls.  Handy for implementing a parser with line-at-a-time
1719
 
lookahead. Note that lines that are &#8220;unread&#8221; with <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> are not
1720
 
subsequently re-cleansed (whitespace  stripped, or whatever) when read with
1721
 
<a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>. If multiple calls are made to <a class="reference internal" href="#distutils.text_file.TextFile.unreadline" title="distutils.text_file.TextFile.unreadline"><code class="xref py py-meth docutils literal"><span class="pre">unreadline()</span></code></a> before a call
1722
 
to <a class="reference internal" href="../library/readline.html#module-readline" title="readline: GNU readline support for Python. (Unix)"><code class="xref py py-meth docutils literal"><span class="pre">readline()</span></code></a>, the lines will be returned most in most recent first order.</p>
1723
 
</dd></dl>
1724
 
 
1725
 
</dd></dl>
1726
 
 
1727
 
</div>
1728
 
<div class="section" id="module-distutils.version">
1729
 
<span id="distutils-version-version-number-classes"></span><h2>10.22. <a class="reference internal" href="#module-distutils.version" title="distutils.version: implements classes that represent module version numbers."><code class="xref py py-mod docutils literal"><span class="pre">distutils.version</span></code></a> &#8212; Version number classes<a class="headerlink" href="#module-distutils.version" title="Permalink to this headline">¶</a></h2>
1730
 
</div>
1731
 
<div class="section" id="module-distutils.cmd">
1732
 
<span id="distutils-cmd-abstract-base-class-for-distutils-commands"></span><h2>10.23. <a class="reference internal" href="#module-distutils.cmd" title="distutils.cmd: This module provides the abstract base class Command. This class is subclassed by the modules in the distutils.command subpackage."><code class="xref py py-mod docutils literal"><span class="pre">distutils.cmd</span></code></a> &#8212; Abstract base class for Distutils commands<a class="headerlink" href="#module-distutils.cmd" title="Permalink to this headline">¶</a></h2>
1733
 
<p>This module supplies the abstract base class <a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a>.</p>
1734
 
<dl class="class">
1735
 
<dt id="distutils.cmd.Command">
1736
 
<em class="property">class </em><code class="descclassname">distutils.cmd.</code><code class="descname">Command</code><span class="sig-paren">(</span><em>dist</em><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command" title="Permalink to this definition">¶</a></dt>
1737
 
<dd><p>Abstract base class for defining command classes, the &#8220;worker bees&#8221; of the
1738
 
Distutils.  A useful analogy for command classes is to think of them as
1739
 
subroutines with local variables called <em>options</em>.  The options are declared
1740
 
in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a> and defined (given their final values) in
1741
 
<a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>, both of which must be defined by every command
1742
 
class.  The distinction between the two is necessary because option values
1743
 
might come from the outside world (command line, config file, ...), and any
1744
 
options dependent on other options must be computed after these outside
1745
 
influences have been processed &#8212; hence <a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>.  The body
1746
 
of the subroutine, where it does all its work based on the values of its
1747
 
options, is the <a class="reference internal" href="#distutils.cmd.Command.run" title="distutils.cmd.Command.run"><code class="xref py py-meth docutils literal"><span class="pre">run()</span></code></a> method, which must also be implemented by every
1748
 
command class.</p>
1749
 
<p>The class constructor takes a single argument <em>dist</em>, a
1750
 
<a class="reference internal" href="#distutils.core.Distribution" title="distutils.core.Distribution"><code class="xref py py-class docutils literal"><span class="pre">Distribution</span></code></a> instance.</p>
1751
 
</dd></dl>
1752
 
 
1753
 
</div>
1754
 
<div class="section" id="creating-a-new-distutils-command">
1755
 
<h2>10.24. Creating a new Distutils command<a class="headerlink" href="#creating-a-new-distutils-command" title="Permalink to this headline">¶</a></h2>
1756
 
<p>This section outlines the steps to create a new Distutils command.</p>
1757
 
<p>A new command lives in a module in the <a class="reference internal" href="#module-distutils.command" title="distutils.command: This subpackage contains one module for each standard Distutils command."><code class="xref py py-mod docutils literal"><span class="pre">distutils.command</span></code></a> package. There
1758
 
is a sample template in that directory called <code class="file docutils literal"><span class="pre">command_template</span></code>.  Copy
1759
 
this file to a new module with the same name as the new command you&#8217;re
1760
 
implementing.  This module should implement a class with the same name as the
1761
 
module (and the command).  So, for instance, to create the command
1762
 
<code class="docutils literal"><span class="pre">peel_banana</span></code> (so that users can run <code class="docutils literal"><span class="pre">setup.py</span> <span class="pre">peel_banana</span></code>), you&#8217;d copy
1763
 
<code class="file docutils literal"><span class="pre">command_template</span></code> to <code class="file docutils literal"><span class="pre">distutils/command/peel_banana.py</span></code>, then edit
1764
 
it so that it&#8217;s implementing the class <code class="xref py py-class docutils literal"><span class="pre">peel_banana</span></code>, a subclass of
1765
 
<a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">distutils.cmd.Command</span></code></a>.</p>
1766
 
<p>Subclasses of <a class="reference internal" href="#distutils.cmd.Command" title="distutils.cmd.Command"><code class="xref py py-class docutils literal"><span class="pre">Command</span></code></a> must define the following methods.</p>
1767
 
<dl class="method">
1768
 
<dt id="distutils.cmd.Command.initialize_options">
1769
 
<code class="descclassname">Command.</code><code class="descname">initialize_options</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.initialize_options" title="Permalink to this definition">¶</a></dt>
1770
 
<dd><p>Set default values for all the options that this command supports.  Note that
1771
 
these defaults may be overridden by other commands, by the setup script, by
1772
 
config files, or by the command-line.  Thus, this is not the place to code
1773
 
dependencies between options; generally, <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>
1774
 
implementations are just a bunch of <code class="docutils literal"><span class="pre">self.foo</span> <span class="pre">=</span> <span class="pre">None</span></code> assignments.</p>
1775
 
</dd></dl>
1776
 
 
1777
 
<dl class="method">
1778
 
<dt id="distutils.cmd.Command.finalize_options">
1779
 
<code class="descclassname">Command.</code><code class="descname">finalize_options</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.finalize_options" title="Permalink to this definition">¶</a></dt>
1780
 
<dd><p>Set final values for all the options that this command supports. This is
1781
 
always called as late as possible, ie.  after any option assignments from the
1782
 
command-line or from other commands have been done.  Thus, this is the place
1783
 
to code option dependencies: if <em>foo</em> depends on <em>bar</em>, then it is safe to
1784
 
set <em>foo</em> from <em>bar</em> as long as <em>foo</em> still has the same value it was
1785
 
assigned in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>.</p>
1786
 
</dd></dl>
1787
 
 
1788
 
<dl class="method">
1789
 
<dt id="distutils.cmd.Command.run">
1790
 
<code class="descclassname">Command.</code><code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#distutils.cmd.Command.run" title="Permalink to this definition">¶</a></dt>
1791
 
<dd><p>A command&#8217;s raison d&#8217;etre: carry out the action it exists to perform, controlled
1792
 
by the options initialized in <a class="reference internal" href="#distutils.cmd.Command.initialize_options" title="distutils.cmd.Command.initialize_options"><code class="xref py py-meth docutils literal"><span class="pre">initialize_options()</span></code></a>, customized by other
1793
 
commands, the setup script, the command-line, and config files, and finalized in
1794
 
<a class="reference internal" href="#distutils.cmd.Command.finalize_options" title="distutils.cmd.Command.finalize_options"><code class="xref py py-meth docutils literal"><span class="pre">finalize_options()</span></code></a>.  All terminal output and filesystem interaction should
1795
 
be done by <a class="reference internal" href="#distutils.cmd.Command.run" title="distutils.cmd.Command.run"><code class="xref py py-meth docutils literal"><span class="pre">run()</span></code></a>.</p>
1796
 
</dd></dl>
1797
 
 
1798
 
<dl class="attribute">
1799
 
<dt id="distutils.cmd.Command.sub_commands">
1800
 
<code class="descclassname">Command.</code><code class="descname">sub_commands</code><a class="headerlink" href="#distutils.cmd.Command.sub_commands" title="Permalink to this definition">¶</a></dt>
1801
 
<dd><p><em>sub_commands</em> formalizes the notion of a &#8220;family&#8221; of commands,
1802
 
e.g. <code class="docutils literal"><span class="pre">install</span></code> as the parent with sub-commands <code class="docutils literal"><span class="pre">install_lib</span></code>,
1803
 
<code class="docutils literal"><span class="pre">install_headers</span></code>, etc.  The parent of a family of commands defines
1804
 
<em>sub_commands</em> as a class attribute; it&#8217;s a list of 2-tuples <code class="docutils literal"><span class="pre">(command_name,</span>
1805
 
<span class="pre">predicate)</span></code>, with <em>command_name</em> a string and <em>predicate</em> a function, a
1806
 
string or <code class="docutils literal"><span class="pre">None</span></code>.  <em>predicate</em> is a method of the parent command that
1807
 
determines whether the corresponding command is applicable in the current
1808
 
situation.  (E.g. <code class="docutils literal"><span class="pre">install_headers</span></code> is only applicable if we have any C
1809
 
header files to install.)  If <em>predicate</em> is <code class="docutils literal"><span class="pre">None</span></code>, that command is always
1810
 
applicable.</p>
1811
 
<p><em>sub_commands</em> is usually defined at the <em>end</em> of a class, because
1812
 
predicates can be methods of the class, so they must already have been
1813
 
defined.  The canonical example is the <strong class="command">install</strong> command.</p>
1814
 
</dd></dl>
1815
 
 
1816
 
</div>
1817
 
<div class="section" id="module-distutils.command">
1818
 
<span id="distutils-command-individual-distutils-commands"></span><h2>10.25. <a class="reference internal" href="#module-distutils.command" title="distutils.command: This subpackage contains one module for each standard Distutils command."><code class="xref py py-mod docutils literal"><span class="pre">distutils.command</span></code></a> &#8212; Individual Distutils commands<a class="headerlink" href="#module-distutils.command" title="Permalink to this headline">¶</a></h2>
1819
 
</div>
1820
 
<div class="section" id="module-distutils.command.bdist">
1821
 
<span id="distutils-command-bdist-build-a-binary-installer"></span><h2>10.26. <a class="reference internal" href="#module-distutils.command.bdist" title="distutils.command.bdist: Build a binary installer for a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist</span></code></a> &#8212; Build a binary installer<a class="headerlink" href="#module-distutils.command.bdist" title="Permalink to this headline">¶</a></h2>
1822
 
</div>
1823
 
<div class="section" id="module-distutils.command.bdist_packager">
1824
 
<span id="distutils-command-bdist-packager-abstract-base-class-for-packagers"></span><h2>10.27. <a class="reference internal" href="#module-distutils.command.bdist_packager" title="distutils.command.bdist_packager: Abstract base class for packagers"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_packager</span></code></a> &#8212; Abstract base class for packagers<a class="headerlink" href="#module-distutils.command.bdist_packager" title="Permalink to this headline">¶</a></h2>
1825
 
</div>
1826
 
<div class="section" id="module-distutils.command.bdist_dumb">
1827
 
<span id="distutils-command-bdist-dumb-build-a-dumb-installer"></span><h2>10.28. <a class="reference internal" href="#module-distutils.command.bdist_dumb" title="distutils.command.bdist_dumb: Build a &quot;dumb&quot; installer - a simple archive of files"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_dumb</span></code></a> &#8212; Build a &#8220;dumb&#8221; installer<a class="headerlink" href="#module-distutils.command.bdist_dumb" title="Permalink to this headline">¶</a></h2>
1828
 
</div>
1829
 
<div class="section" id="module-distutils.command.bdist_msi">
1830
 
<span id="distutils-command-bdist-msi-build-a-microsoft-installer-binary-package"></span><h2>10.29. <a class="reference internal" href="#module-distutils.command.bdist_msi" title="distutils.command.bdist_msi: Build a binary distribution as a Windows MSI file"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_msi</span></code></a> &#8212; Build a Microsoft Installer binary package<a class="headerlink" href="#module-distutils.command.bdist_msi" title="Permalink to this headline">¶</a></h2>
1831
 
<dl class="class">
1832
 
<dt id="distutils.command.bdist_msi.bdist_msi">
1833
 
<em class="property">class </em><code class="descclassname">distutils.command.bdist_msi.</code><code class="descname">bdist_msi</code><a class="headerlink" href="#distutils.command.bdist_msi.bdist_msi" title="Permalink to this definition">¶</a></dt>
1834
 
<dd><p>Builds a <a class="reference external" href="http://msdn.microsoft.com/en-us/library/cc185688(VS.85).aspx">Windows Installer</a> (.msi) binary package.</p>
1835
 
<p>In most cases, the <code class="docutils literal"><span class="pre">bdist_msi</span></code> installer is a better choice than the
1836
 
<code class="docutils literal"><span class="pre">bdist_wininst</span></code> installer, because it provides better support for
1837
 
Win64 platforms, allows administrators to perform non-interactive
1838
 
installations, and allows installation through group policies.</p>
1839
 
</dd></dl>
1840
 
 
1841
 
</div>
1842
 
<div class="section" id="module-distutils.command.bdist_rpm">
1843
 
<span id="distutils-command-bdist-rpm-build-a-binary-distribution-as-a-redhat-rpm-and-srpm"></span><h2>10.30. <a class="reference internal" href="#module-distutils.command.bdist_rpm" title="distutils.command.bdist_rpm: Build a binary distribution as a Redhat RPM and SRPM"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_rpm</span></code></a> &#8212; Build a binary distribution as a Redhat RPM and SRPM<a class="headerlink" href="#module-distutils.command.bdist_rpm" title="Permalink to this headline">¶</a></h2>
1844
 
</div>
1845
 
<div class="section" id="module-distutils.command.bdist_wininst">
1846
 
<span id="distutils-command-bdist-wininst-build-a-windows-installer"></span><h2>10.31. <a class="reference internal" href="#module-distutils.command.bdist_wininst" title="distutils.command.bdist_wininst: Build a Windows installer"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.bdist_wininst</span></code></a> &#8212; Build a Windows installer<a class="headerlink" href="#module-distutils.command.bdist_wininst" title="Permalink to this headline">¶</a></h2>
1847
 
</div>
1848
 
<div class="section" id="module-distutils.command.sdist">
1849
 
<span id="distutils-command-sdist-build-a-source-distribution"></span><h2>10.32. <a class="reference internal" href="#module-distutils.command.sdist" title="distutils.command.sdist: Build a source distribution"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.sdist</span></code></a> &#8212; Build a source distribution<a class="headerlink" href="#module-distutils.command.sdist" title="Permalink to this headline">¶</a></h2>
1850
 
</div>
1851
 
<div class="section" id="module-distutils.command.build">
1852
 
<span id="distutils-command-build-build-all-files-of-a-package"></span><h2>10.33. <a class="reference internal" href="#module-distutils.command.build" title="distutils.command.build: Build all files of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build</span></code></a> &#8212; Build all files of a package<a class="headerlink" href="#module-distutils.command.build" title="Permalink to this headline">¶</a></h2>
1853
 
</div>
1854
 
<div class="section" id="module-distutils.command.build_clib">
1855
 
<span id="distutils-command-build-clib-build-any-c-libraries-in-a-package"></span><h2>10.34. <a class="reference internal" href="#module-distutils.command.build_clib" title="distutils.command.build_clib: Build any C libraries in a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_clib</span></code></a> &#8212; Build any C libraries in a package<a class="headerlink" href="#module-distutils.command.build_clib" title="Permalink to this headline">¶</a></h2>
1856
 
</div>
1857
 
<div class="section" id="module-distutils.command.build_ext">
1858
 
<span id="distutils-command-build-ext-build-any-extensions-in-a-package"></span><h2>10.35. <a class="reference internal" href="#module-distutils.command.build_ext" title="distutils.command.build_ext: Build any extensions in a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_ext</span></code></a> &#8212; Build any extensions in a package<a class="headerlink" href="#module-distutils.command.build_ext" title="Permalink to this headline">¶</a></h2>
1859
 
</div>
1860
 
<div class="section" id="module-distutils.command.build_py">
1861
 
<span id="distutils-command-build-py-build-the-py-pyc-files-of-a-package"></span><h2>10.36. <a class="reference internal" href="#module-distutils.command.build_py" title="distutils.command.build_py: Build the .py/.pyc files of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_py</span></code></a> &#8212; Build the .py/.pyc files of a package<a class="headerlink" href="#module-distutils.command.build_py" title="Permalink to this headline">¶</a></h2>
1862
 
<dl class="class">
1863
 
<dt id="distutils.command.build_py.build_py">
1864
 
<em class="property">class </em><code class="descclassname">distutils.command.build_py.</code><code class="descname">build_py</code><a class="headerlink" href="#distutils.command.build_py.build_py" title="Permalink to this definition">¶</a></dt>
1865
 
<dd></dd></dl>
1866
 
 
1867
 
<dl class="class">
1868
 
<dt id="distutils.command.build_py.build_py_2to3">
1869
 
<em class="property">class </em><code class="descclassname">distutils.command.build_py.</code><code class="descname">build_py_2to3</code><a class="headerlink" href="#distutils.command.build_py.build_py_2to3" title="Permalink to this definition">¶</a></dt>
1870
 
<dd><p>Alternative implementation of build_py which also runs the
1871
 
2to3 conversion library on each .py file that is going to be
1872
 
installed. To use this in a setup.py file for a distribution
1873
 
that is designed to run with both Python 2.x and 3.x, add:</p>
1874
 
<div class="highlight-python3"><div class="highlight"><pre><span class="k">try</span><span class="p">:</span>
1875
 
   <span class="kn">from</span> <span class="nn">distutils.command.build_py</span> <span class="k">import</span> <span class="n">build_py_2to3</span> <span class="k">as</span> <span class="n">build_py</span>
1876
 
<span class="k">except</span> <span class="ne">ImportError</span><span class="p">:</span>
1877
 
   <span class="kn">from</span> <span class="nn">distutils.command.build_py</span> <span class="k">import</span> <span class="n">build_py</span>
1878
 
</pre></div>
1879
 
</div>
1880
 
<p>to your setup.py, and later:</p>
1881
 
<div class="highlight-python3"><div class="highlight"><pre><span class="n">cmdclass</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;build_py&#39;</span><span class="p">:</span> <span class="n">build_py</span><span class="p">}</span>
1882
 
</pre></div>
1883
 
</div>
1884
 
<p>to the invocation of setup().</p>
1885
 
</dd></dl>
1886
 
 
1887
 
</div>
1888
 
<div class="section" id="module-distutils.command.build_scripts">
1889
 
<span id="distutils-command-build-scripts-build-the-scripts-of-a-package"></span><h2>10.37. <a class="reference internal" href="#module-distutils.command.build_scripts" title="distutils.command.build_scripts: Build the scripts of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.build_scripts</span></code></a> &#8212; Build the scripts of a package<a class="headerlink" href="#module-distutils.command.build_scripts" title="Permalink to this headline">¶</a></h2>
1890
 
</div>
1891
 
<div class="section" id="module-distutils.command.clean">
1892
 
<span id="distutils-command-clean-clean-a-package-build-area"></span><h2>10.38. <a class="reference internal" href="#module-distutils.command.clean" title="distutils.command.clean: Clean a package build area"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.clean</span></code></a> &#8212; Clean a package build area<a class="headerlink" href="#module-distutils.command.clean" title="Permalink to this headline">¶</a></h2>
1893
 
<p>This command removes the temporary files created by <strong class="command">build</strong>
1894
 
and its subcommands, like intermediary compiled object files.  With
1895
 
the <code class="docutils literal"><span class="pre">--all</span></code> option, the complete build directory will be removed.</p>
1896
 
<p>Extension modules built <a class="reference internal" href="configfile.html#distutils-build-ext-inplace"><span>in place</span></a>
1897
 
will not be cleaned, as they are not in the build directory.</p>
1898
 
</div>
1899
 
<div class="section" id="module-distutils.command.config">
1900
 
<span id="distutils-command-config-perform-package-configuration"></span><h2>10.39. <a class="reference internal" href="#module-distutils.command.config" title="distutils.command.config: Perform package configuration"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.config</span></code></a> &#8212; Perform package configuration<a class="headerlink" href="#module-distutils.command.config" title="Permalink to this headline">¶</a></h2>
1901
 
</div>
1902
 
<div class="section" id="module-distutils.command.install">
1903
 
<span id="distutils-command-install-install-a-package"></span><h2>10.40. <a class="reference internal" href="#module-distutils.command.install" title="distutils.command.install: Install a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install</span></code></a> &#8212; Install a package<a class="headerlink" href="#module-distutils.command.install" title="Permalink to this headline">¶</a></h2>
1904
 
</div>
1905
 
<div class="section" id="module-distutils.command.install_data">
1906
 
<span id="distutils-command-install-data-install-data-files-from-a-package"></span><h2>10.41. <a class="reference internal" href="#module-distutils.command.install_data" title="distutils.command.install_data: Install data files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_data</span></code></a> &#8212; Install data files from a package<a class="headerlink" href="#module-distutils.command.install_data" title="Permalink to this headline">¶</a></h2>
1907
 
</div>
1908
 
<div class="section" id="module-distutils.command.install_headers">
1909
 
<span id="distutils-command-install-headers-install-c-c-header-files-from-a-package"></span><h2>10.42. <a class="reference internal" href="#module-distutils.command.install_headers" title="distutils.command.install_headers: Install C/C++ header files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_headers</span></code></a> &#8212; Install C/C++ header files from a package<a class="headerlink" href="#module-distutils.command.install_headers" title="Permalink to this headline">¶</a></h2>
1910
 
</div>
1911
 
<div class="section" id="module-distutils.command.install_lib">
1912
 
<span id="distutils-command-install-lib-install-library-files-from-a-package"></span><h2>10.43. <a class="reference internal" href="#module-distutils.command.install_lib" title="distutils.command.install_lib: Install library files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_lib</span></code></a> &#8212; Install library files from a package<a class="headerlink" href="#module-distutils.command.install_lib" title="Permalink to this headline">¶</a></h2>
1913
 
</div>
1914
 
<div class="section" id="module-distutils.command.install_scripts">
1915
 
<span id="distutils-command-install-scripts-install-script-files-from-a-package"></span><h2>10.44. <a class="reference internal" href="#module-distutils.command.install_scripts" title="distutils.command.install_scripts: Install script files from a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.install_scripts</span></code></a> &#8212; Install script files from a package<a class="headerlink" href="#module-distutils.command.install_scripts" title="Permalink to this headline">¶</a></h2>
1916
 
</div>
1917
 
<div class="section" id="module-distutils.command.register">
1918
 
<span id="distutils-command-register-register-a-module-with-the-python-package-index"></span><h2>10.45. <a class="reference internal" href="#module-distutils.command.register" title="distutils.command.register: Register a module with the Python Package Index"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.register</span></code></a> &#8212; Register a module with the Python Package Index<a class="headerlink" href="#module-distutils.command.register" title="Permalink to this headline">¶</a></h2>
1919
 
<p>The <code class="docutils literal"><span class="pre">register</span></code> command registers the package with the Python Package  Index.
1920
 
This is described in more detail in <span class="target" id="index-6"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0301"><strong>PEP 301</strong></a>.</p>
1921
 
</div>
1922
 
<div class="section" id="module-distutils.command.check">
1923
 
<span id="distutils-command-check-check-the-meta-data-of-a-package"></span><h2>10.46. <a class="reference internal" href="#module-distutils.command.check" title="distutils.command.check: Check the metadata of a package"><code class="xref py py-mod docutils literal"><span class="pre">distutils.command.check</span></code></a> &#8212; Check the meta-data of a package<a class="headerlink" href="#module-distutils.command.check" title="Permalink to this headline">¶</a></h2>
1924
 
<p>The <code class="docutils literal"><span class="pre">check</span></code> command performs some tests on the meta-data of a package.
1925
 
For example, it verifies that all required meta-data are provided as
1926
 
the arguments passed to the <code class="xref py py-func docutils literal"><span class="pre">setup()</span></code> function.</p>
1927
 
</div>
1928
 
</div>
1929
 
 
1930
 
 
1931
 
          </div>
1932
 
        </div>
1933
 
      </div>
1934
 
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
1935
 
        <div class="sphinxsidebarwrapper">
1936
 
  <h3><a href="../contents.html">Table Of Contents</a></h3>
1937
 
  <ul>
1938
 
<li><a class="reference internal" href="#">10. API Reference</a><ul>
1939
 
<li><a class="reference internal" href="#module-distutils.core">10.1. <code class="docutils literal"><span class="pre">distutils.core</span></code> &#8212; Core Distutils functionality</a></li>
1940
 
<li><a class="reference internal" href="#module-distutils.ccompiler">10.2. <code class="docutils literal"><span class="pre">distutils.ccompiler</span></code> &#8212; CCompiler base class</a></li>
1941
 
<li><a class="reference internal" href="#module-distutils.unixccompiler">10.3. <code class="docutils literal"><span class="pre">distutils.unixccompiler</span></code> &#8212; Unix C Compiler</a></li>
1942
 
<li><a class="reference internal" href="#module-distutils.msvccompiler">10.4. <code class="docutils literal"><span class="pre">distutils.msvccompiler</span></code> &#8212; Microsoft Compiler</a></li>
1943
 
<li><a class="reference internal" href="#module-distutils.bcppcompiler">10.5. <code class="docutils literal"><span class="pre">distutils.bcppcompiler</span></code> &#8212; Borland Compiler</a></li>
1944
 
<li><a class="reference internal" href="#module-distutils.cygwinccompiler">10.6. <code class="docutils literal"><span class="pre">distutils.cygwincompiler</span></code> &#8212; Cygwin Compiler</a></li>
1945
 
<li><a class="reference internal" href="#module-distutils.archive_util">10.7. <code class="docutils literal"><span class="pre">distutils.archive_util</span></code> &#8212;  Archiving utilities</a></li>
1946
 
<li><a class="reference internal" href="#module-distutils.dep_util">10.8. <code class="docutils literal"><span class="pre">distutils.dep_util</span></code> &#8212; Dependency checking</a></li>
1947
 
<li><a class="reference internal" href="#module-distutils.dir_util">10.9. <code class="docutils literal"><span class="pre">distutils.dir_util</span></code> &#8212; Directory tree operations</a></li>
1948
 
<li><a class="reference internal" href="#module-distutils.file_util">10.10. <code class="docutils literal"><span class="pre">distutils.file_util</span></code> &#8212; Single file operations</a></li>
1949
 
<li><a class="reference internal" href="#module-distutils.util">10.11. <code class="docutils literal"><span class="pre">distutils.util</span></code> &#8212; Miscellaneous other utility functions</a></li>
1950
 
<li><a class="reference internal" href="#module-distutils.dist">10.12. <code class="docutils literal"><span class="pre">distutils.dist</span></code> &#8212; The Distribution class</a></li>
1951
 
<li><a class="reference internal" href="#module-distutils.extension">10.13. <code class="docutils literal"><span class="pre">distutils.extension</span></code> &#8212; The Extension class</a></li>
1952
 
<li><a class="reference internal" href="#module-distutils.debug">10.14. <code class="docutils literal"><span class="pre">distutils.debug</span></code> &#8212; Distutils debug mode</a></li>
1953
 
<li><a class="reference internal" href="#module-distutils.errors">10.15. <code class="docutils literal"><span class="pre">distutils.errors</span></code> &#8212; Distutils exceptions</a></li>
1954
 
<li><a class="reference internal" href="#module-distutils.fancy_getopt">10.16. <code class="docutils literal"><span class="pre">distutils.fancy_getopt</span></code> &#8212; Wrapper around the standard getopt module</a></li>
1955
 
<li><a class="reference internal" href="#module-distutils.filelist">10.17. <code class="docutils literal"><span class="pre">distutils.filelist</span></code> &#8212; The FileList class</a></li>
1956
 
<li><a class="reference internal" href="#module-distutils.log">10.18. <code class="docutils literal"><span class="pre">distutils.log</span></code> &#8212; Simple PEP 282-style logging</a></li>
1957
 
<li><a class="reference internal" href="#module-distutils.spawn">10.19. <code class="docutils literal"><span class="pre">distutils.spawn</span></code> &#8212; Spawn a sub-process</a></li>
1958
 
<li><a class="reference internal" href="#module-distutils.sysconfig">10.20. <code class="docutils literal"><span class="pre">distutils.sysconfig</span></code> &#8212; System configuration information</a></li>
1959
 
<li><a class="reference internal" href="#module-distutils.text_file">10.21. <code class="docutils literal"><span class="pre">distutils.text_file</span></code> &#8212; The TextFile class</a></li>
1960
 
<li><a class="reference internal" href="#module-distutils.version">10.22. <code class="docutils literal"><span class="pre">distutils.version</span></code> &#8212; Version number classes</a></li>
1961
 
<li><a class="reference internal" href="#module-distutils.cmd">10.23. <code class="docutils literal"><span class="pre">distutils.cmd</span></code> &#8212; Abstract base class for Distutils commands</a></li>
1962
 
<li><a class="reference internal" href="#creating-a-new-distutils-command">10.24. Creating a new Distutils command</a></li>
1963
 
<li><a class="reference internal" href="#module-distutils.command">10.25. <code class="docutils literal"><span class="pre">distutils.command</span></code> &#8212; Individual Distutils commands</a></li>
1964
 
<li><a class="reference internal" href="#module-distutils.command.bdist">10.26. <code class="docutils literal"><span class="pre">distutils.command.bdist</span></code> &#8212; Build a binary installer</a></li>
1965
 
<li><a class="reference internal" href="#module-distutils.command.bdist_packager">10.27. <code class="docutils literal"><span class="pre">distutils.command.bdist_packager</span></code> &#8212; Abstract base class for packagers</a></li>
1966
 
<li><a class="reference internal" href="#module-distutils.command.bdist_dumb">10.28. <code class="docutils literal"><span class="pre">distutils.command.bdist_dumb</span></code> &#8212; Build a &#8220;dumb&#8221; installer</a></li>
1967
 
<li><a class="reference internal" href="#module-distutils.command.bdist_msi">10.29. <code class="docutils literal"><span class="pre">distutils.command.bdist_msi</span></code> &#8212; Build a Microsoft Installer binary package</a></li>
1968
 
<li><a class="reference internal" href="#module-distutils.command.bdist_rpm">10.30. <code class="docutils literal"><span class="pre">distutils.command.bdist_rpm</span></code> &#8212; Build a binary distribution as a Redhat RPM and SRPM</a></li>
1969
 
<li><a class="reference internal" href="#module-distutils.command.bdist_wininst">10.31. <code class="docutils literal"><span class="pre">distutils.command.bdist_wininst</span></code> &#8212; Build a Windows installer</a></li>
1970
 
<li><a class="reference internal" href="#module-distutils.command.sdist">10.32. <code class="docutils literal"><span class="pre">distutils.command.sdist</span></code> &#8212; Build a source distribution</a></li>
1971
 
<li><a class="reference internal" href="#module-distutils.command.build">10.33. <code class="docutils literal"><span class="pre">distutils.command.build</span></code> &#8212; Build all files of a package</a></li>
1972
 
<li><a class="reference internal" href="#module-distutils.command.build_clib">10.34. <code class="docutils literal"><span class="pre">distutils.command.build_clib</span></code> &#8212; Build any C libraries in a package</a></li>
1973
 
<li><a class="reference internal" href="#module-distutils.command.build_ext">10.35. <code class="docutils literal"><span class="pre">distutils.command.build_ext</span></code> &#8212; Build any extensions in a package</a></li>
1974
 
<li><a class="reference internal" href="#module-distutils.command.build_py">10.36. <code class="docutils literal"><span class="pre">distutils.command.build_py</span></code> &#8212; Build the .py/.pyc files of a package</a></li>
1975
 
<li><a class="reference internal" href="#module-distutils.command.build_scripts">10.37. <code class="docutils literal"><span class="pre">distutils.command.build_scripts</span></code> &#8212; Build the scripts of a package</a></li>
1976
 
<li><a class="reference internal" href="#module-distutils.command.clean">10.38. <code class="docutils literal"><span class="pre">distutils.command.clean</span></code> &#8212; Clean a package build area</a></li>
1977
 
<li><a class="reference internal" href="#module-distutils.command.config">10.39. <code class="docutils literal"><span class="pre">distutils.command.config</span></code> &#8212; Perform package configuration</a></li>
1978
 
<li><a class="reference internal" href="#module-distutils.command.install">10.40. <code class="docutils literal"><span class="pre">distutils.command.install</span></code> &#8212; Install a package</a></li>
1979
 
<li><a class="reference internal" href="#module-distutils.command.install_data">10.41. <code class="docutils literal"><span class="pre">distutils.command.install_data</span></code> &#8212; Install data files from a package</a></li>
1980
 
<li><a class="reference internal" href="#module-distutils.command.install_headers">10.42. <code class="docutils literal"><span class="pre">distutils.command.install_headers</span></code> &#8212; Install C/C++ header files from a package</a></li>
1981
 
<li><a class="reference internal" href="#module-distutils.command.install_lib">10.43. <code class="docutils literal"><span class="pre">distutils.command.install_lib</span></code> &#8212; Install library files from a package</a></li>
1982
 
<li><a class="reference internal" href="#module-distutils.command.install_scripts">10.44. <code class="docutils literal"><span class="pre">distutils.command.install_scripts</span></code> &#8212; Install script files from a package</a></li>
1983
 
<li><a class="reference internal" href="#module-distutils.command.register">10.45. <code class="docutils literal"><span class="pre">distutils.command.register</span></code> &#8212; Register a module with the Python Package Index</a></li>
1984
 
<li><a class="reference internal" href="#module-distutils.command.check">10.46. <code class="docutils literal"><span class="pre">distutils.command.check</span></code> &#8212; Check the meta-data of a package</a></li>
1985
 
</ul>
1986
 
</li>
1987
 
</ul>
1988
 
 
1989
 
  <h4>Previous topic</h4>
1990
 
  <p class="topless"><a href="commandref.html"
1991
 
                        title="previous chapter">9. Command Reference</a></p>
1992
 
  <h4>Next topic</h4>
1993
 
  <p class="topless"><a href="../install/index.html"
1994
 
                        title="next chapter">Installing Python Modules (Legacy version)</a></p>
1995
 
<h3>This Page</h3>
1996
 
<ul class="this-page-menu">
1997
 
  <li><a href="../bugs.html">Report a Bug</a></li>
1998
 
  <li><a href="../_sources/distutils/apiref.txt"
1999
 
         rel="nofollow">Show Source</a></li>
2000
 
</ul>
2001
 
 
2002
 
<div id="searchbox" style="display: none" role="search">
2003
 
  <h3>Quick search</h3>
2004
 
    <form class="search" action="../search.html" method="get">
2005
 
      <input type="text" name="q" />
2006
 
      <input type="submit" value="Go" />
2007
 
      <input type="hidden" name="check_keywords" value="yes" />
2008
 
      <input type="hidden" name="area" value="default" />
2009
 
    </form>
2010
 
    <p class="searchtip" style="font-size: 90%">
2011
 
    Enter search terms or a module, class or function name.
2012
 
    </p>
2013
 
</div>
2014
 
<script type="text/javascript">$('#searchbox').show(0);</script>
2015
 
        </div>
2016
 
      </div>
2017
 
      <div class="clearer"></div>
2018
 
    </div>  
2019
 
    <div class="related" role="navigation" aria-label="related navigation">
2020
 
      <h3>Navigation</h3>
2021
 
      <ul>
2022
 
        <li class="right" style="margin-right: 10px">
2023
 
          <a href="../genindex.html" title="General Index"
2024
 
             >index</a></li>
2025
 
        <li class="right" >
2026
 
          <a href="../py-modindex.html" title="Python Module Index"
2027
 
             >modules</a> |</li>
2028
 
        <li class="right" >
2029
 
          <a href="../install/index.html" title="Installing Python Modules (Legacy version)"
2030
 
             >next</a> |</li>
2031
 
        <li class="right" >
2032
 
          <a href="commandref.html" title="9. Command Reference"
2033
 
             >previous</a> |</li>
2034
 
        <li><img src="../_static/py.png" alt=""
2035
 
                 style="vertical-align: middle; margin-top: -1px"/></li>
2036
 
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
2037
 
        <li>
2038
 
          <span class="version_switcher_placeholder">3.5.1</span>
2039
 
          <a href="../index.html">Documentation </a> &raquo;
2040
 
        </li>
2041
 
 
2042
 
          <li class="nav-item nav-item-1"><a href="index.html" >Distributing Python Modules (Legacy version)</a> &raquo;</li> 
2043
 
      </ul>
2044
 
    </div>  
2045
 
    <div class="footer">
2046
 
    &copy; <a href="../copyright.html">Copyright</a> 1990-2016, Python Software Foundation.
2047
 
    <br />
2048
 
    The Python Software Foundation is a non-profit corporation.
2049
 
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
2050
 
    <br />
2051
 
    Last updated on Jan 22, 2016.
2052
 
    <a href="../bugs.html">Found a bug</a>?
2053
 
    <br />
2054
 
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.3.3.
2055
 
    </div>
2056
 
 
2057
 
  </body>
2058
 
</html>
 
 
b'\\ No newline at end of file'