blob: 8943fdb5052fd3b9b65a90bf7b080793b9c82488 [file] [log] [blame]
Greg Wardabc52162000-02-26 00:52:48 +00001\documentclass{howto}
Greg Ward16aafcd2000-04-09 04:06:44 +00002\usepackage{distutils}
Greg Wardabc52162000-02-26 00:52:48 +00003
Greg Wardb6528972000-09-07 02:40:37 +00004% $Id$
5
Greg Ward16aafcd2000-04-09 04:06:44 +00006\title{Distributing Python Modules}
Greg Wardabc52162000-02-26 00:52:48 +00007
Greg Wardabc52162000-02-26 00:52:48 +00008\author{Greg Ward}
9\authoraddress{E-mail: \email{gward@python.net}}
10
Greg Warde3cca262000-08-31 16:36:31 +000011\makeindex
Greg Ward16aafcd2000-04-09 04:06:44 +000012
Greg Wardabc52162000-02-26 00:52:48 +000013\begin{document}
14
Greg Wardfacb8db2000-04-09 04:32:40 +000015\maketitle
Greg Warde3cca262000-08-31 16:36:31 +000016\begin{abstract}
17 \noindent
18 This document describes the Python Distribution Utilities
19 (``Distutils'') from the module developer's point-of-view, describing
20 how to use the Distutils to make Python modules and extensions easily
21 available to a wider audience with very little overhead for
22 build/release/install mechanics.
23\end{abstract}
24
Greg Wardfacb8db2000-04-09 04:32:40 +000025\tableofcontents
Greg Ward16aafcd2000-04-09 04:06:44 +000026
27\section{Introduction}
Greg Warde78298a2000-04-28 17:12:24 +000028\label{intro}
Greg Ward16aafcd2000-04-09 04:06:44 +000029
30In the past, Python module developers have not had much infrastructure
31support for distributing modules, nor have Python users had much support
32for installing and maintaining third-party modules. With the
33introduction of the Python Distribution Utilities (Distutils for short)
Greg Ward1d8f57a2000-08-05 00:43:11 +000034in Python 1.6, this situation should start to improve.
Greg Ward16aafcd2000-04-09 04:06:44 +000035
36This document only covers using the Distutils to distribute your Python
Greg Ward1d8f57a2000-08-05 00:43:11 +000037modules. Using the Distutils does not tie you to Python 1.6, though:
38the Distutils work just fine with Python 1.5.2, and it is reasonable
39(and expected to become commonplace) to expect users of Python 1.5.2 to
Greg Ward16aafcd2000-04-09 04:06:44 +000040download and install the Distutils separately before they can install
Greg Ward1d8f57a2000-08-05 00:43:11 +000041your modules. Python 1.6 (or later) users, of course, won't have to add
42anything to their Python installation in order to use the Distutils to
43install third-party modules.
Greg Ward16aafcd2000-04-09 04:06:44 +000044
45This document concentrates on the role of developer/distributor: if
Fred Drake01df4532000-06-30 03:36:41 +000046you're looking for information on installing Python modules, you
47should refer to the \citetitle[../inst/inst.html]{Installing Python
48Modules} manual.
Greg Ward16aafcd2000-04-09 04:06:44 +000049
50
Greg Wardfacb8db2000-04-09 04:32:40 +000051\section{Concepts \& Terminology}
Greg Warde78298a2000-04-28 17:12:24 +000052\label{concepts}
Greg Ward16aafcd2000-04-09 04:06:44 +000053
54Using the Distutils is quite simple, both for module developers and for
55users/administrators installing third-party modules. As a developer,
Thomas Heller5f52f722001-02-19 17:48:03 +000056your responsibilities (apart from writing solid, well-documented and
Greg Ward16aafcd2000-04-09 04:06:44 +000057well-tested code, of course!) are:
58\begin{itemize}
59\item write a setup script (\file{setup.py} by convention)
60\item (optional) write a setup configuration file
61\item create a source distribution
62\item (optional) create one or more built (binary) distributions
63\end{itemize}
64Each of these tasks is covered in this document.
65
66Not all module developers have access to a multitude of platforms, so
67it's not always feasible to expect them to create a multitude of built
68distributions. It is hoped that a class of intermediaries, called
Greg Ward19c67f82000-06-24 01:33:16 +000069\emph{packagers}, will arise to address this need. Packagers will take
70source distributions released by module developers, build them on one or
71more platforms, and release the resulting built distributions. Thus,
72users on the most popular platforms will be able to install most popular
73Python module distributions in the most natural way for their platform,
74without having to run a single setup script or compile a line of code.
Greg Ward16aafcd2000-04-09 04:06:44 +000075
76
77\subsection{A simple example}
Greg Warde78298a2000-04-28 17:12:24 +000078\label{simple-example}
Greg Ward16aafcd2000-04-09 04:06:44 +000079
80The setup script is usually quite simple, although since it's written in
Greg Ward47f99a62000-09-04 20:07:15 +000081Python, there are no arbitrary limits to what you can do with
82it.\footnote{But be careful about putting arbitrarily expensive
83 operations in your setup script; unlike, say, Autoconf-style configure
84 scripts, the setup script may be run multiple times in the course of
85 building and installing your module distribution. If you need to
86 insert potentially expensive processing steps into the Distutils
87 chain, see section~\ref{extending} on extending the Distutils.} If
Greg Ward1d8f57a2000-08-05 00:43:11 +000088all you want to do is distribute a module called \module{foo}, contained
89in a file \file{foo.py}, then your setup script can be as little as
90this:
Greg Ward16aafcd2000-04-09 04:06:44 +000091\begin{verbatim}
92from distutils.core import setup
93setup (name = "foo",
94 version = "1.0",
95 py_modules = ["foo"])
96\end{verbatim}
Greg Ward370248d2000-06-24 01:45:47 +000097
Greg Ward16aafcd2000-04-09 04:06:44 +000098Some observations:
99\begin{itemize}
Greg Ward370248d2000-06-24 01:45:47 +0000100\item most information that you supply to the Distutils is supplied as
Greg Wardfacb8db2000-04-09 04:32:40 +0000101 keyword arguments to the \function{setup()} function
Greg Ward16aafcd2000-04-09 04:06:44 +0000102\item those keyword arguments fall into two categories: package
103 meta-data (name, version number) and information about what's in the
Greg Ward370248d2000-06-24 01:45:47 +0000104 package (a list of pure Python modules, in this case)
Greg Ward16aafcd2000-04-09 04:06:44 +0000105\item modules are specified by module name, not filename (the same will
106 hold true for packages and extensions)
107\item it's recommended that you supply a little more meta-data, in
108 particular your name, email address and a URL for the project
Greg Ward47f99a62000-09-04 20:07:15 +0000109 (see section~\ref{setup-script} for an example)
Greg Ward16aafcd2000-04-09 04:06:44 +0000110\end{itemize}
111
Greg Ward370248d2000-06-24 01:45:47 +0000112To create a source distribution for this module, you would create a
113setup script, \file{setup.py}, containing the above code, and run:
Greg Ward16aafcd2000-04-09 04:06:44 +0000114\begin{verbatim}
115python setup.py sdist
116\end{verbatim}
Fred Drakeeff9a872000-10-26 16:41:03 +0000117which will create an archive file (e.g., tarball on \UNIX, ZIP file on
Greg Ward16aafcd2000-04-09 04:06:44 +0000118Windows) containing your setup script, \file{setup.py}, and your module,
119\file{foo.py}. The archive file will be named \file{Foo-1.0.tar.gz} (or
120\file{.zip}), and will unpack into a directory \file{Foo-1.0}.
121
122If an end-user wishes to install your \module{foo} module, all she has
Greg Ward59d382e2000-05-26 01:04:47 +0000123to do is download \file{Foo-1.0.tar.gz} (or \file{.zip}), unpack it,
Greg Ward16aafcd2000-04-09 04:06:44 +0000124and---from the \file{Foo-1.0} directory---run
125\begin{verbatim}
126python setup.py install
127\end{verbatim}
128which will ultimately copy \file{foo.py} to the appropriate directory
129for third-party modules in their Python installation.
130
131This simple example demonstrates some fundamental concepts of the
132Distutils: first, both developers and installers have the same basic
133user interface, i.e. the setup script. The difference is which
134Distutils \emph{commands} they use: the \command{sdist} command is
135almost exclusively for module developers, while \command{install} is
136more often for installers (although most developers will want to install
137their own code occasionally).
138
Greg Ward16aafcd2000-04-09 04:06:44 +0000139If you want to make things really easy for your users, you can create
140one or more built distributions for them. For instance, if you are
141running on a Windows machine, and want to make things easy for other
142Windows users, you can create an executable installer (the most
143appropriate type of built distribution for this platform) with the
Greg Ward59d382e2000-05-26 01:04:47 +0000144\command{bdist\_wininst} command. For example:
Greg Ward16aafcd2000-04-09 04:06:44 +0000145\begin{verbatim}
Greg Ward59d382e2000-05-26 01:04:47 +0000146python setup.py bdist_wininst
Greg Ward16aafcd2000-04-09 04:06:44 +0000147\end{verbatim}
Greg Ward1d8f57a2000-08-05 00:43:11 +0000148will create an executable installer, \file{Foo-1.0.win32.exe}, in the
149current directory.
Greg Ward16aafcd2000-04-09 04:06:44 +0000150
Thomas Heller5f52f722001-02-19 17:48:03 +0000151Currently (Distutils 0.9.2), the only other useful built
Greg Ward1d8f57a2000-08-05 00:43:11 +0000152distribution format is RPM, implemented by the \command{bdist\_rpm}
153command. For example, the following command will create an RPM file
154called \file{Foo-1.0.noarch.rpm}:
155\begin{verbatim}
156python setup.py bdist_rpm
157\end{verbatim}
158(This uses the \command{rpm} command, so has to be run on an RPM-based
159system such as Red Hat Linux, SuSE Linux, or Mandrake Linux.)
160
161You can find out what distribution formats are available at any time by
162running
163\begin{verbatim}
164python setup.py bdist --help-formats
165\end{verbatim}
Greg Ward16aafcd2000-04-09 04:06:44 +0000166
167
168\subsection{General Python terminology}
Greg Warde78298a2000-04-28 17:12:24 +0000169\label{python-terms}
Greg Ward16aafcd2000-04-09 04:06:44 +0000170
171If you're reading this document, you probably have a good idea of what
172modules, extensions, and so forth are. Nevertheless, just to be sure
173that everyone is operating from a common starting point, we offer the
174following glossary of common Python terms:
175\begin{description}
176\item[module] the basic unit of code reusability in Python: a block of
Greg Ward1d8f57a2000-08-05 00:43:11 +0000177 code imported by some other code. Three types of modules concern us
178 here: pure Python modules, extension modules, and packages.
Greg Ward16aafcd2000-04-09 04:06:44 +0000179\item[pure Python module] a module written in Python and contained in a
180 single \file{.py} file (and possibly associated \file{.pyc} and/or
181 \file{.pyo} files). Sometimes referred to as a ``pure module.''
182\item[extension module] a module written in the low-level language of
Thomas Heller5f52f722001-02-19 17:48:03 +0000183 the Python implementation: C/C++ for Python, Java for JPython.
Greg Ward16aafcd2000-04-09 04:06:44 +0000184 Typically contained in a single dynamically loadable pre-compiled
Fred Drakeeff9a872000-10-26 16:41:03 +0000185 file, e.g. a shared object (\file{.so}) file for Python extensions on
186 \UNIX, a DLL (given the \file{.pyd} extension) for Python extensions
Greg Ward1bbe3292000-06-25 03:14:13 +0000187 on Windows, or a Java class file for JPython extensions. (Note that
Fred Drakeeff9a872000-10-26 16:41:03 +0000188 currently, the Distutils only handles C/C++ extensions for Python.)
Greg Ward16aafcd2000-04-09 04:06:44 +0000189\item[package] a module that contains other modules; typically contained
190 in a directory in the filesystem and distinguished from other
191 directories by the presence of a file \file{\_\_init\_\_.py}.
Greg Ward6153fa12000-05-26 02:24:28 +0000192\item[root package] the root of the hierarchy of packages. (This isn't
193 really a package, since it doesn't have an \file{\_\_init\_\_.py}
194 file. But we have to call it something.) The vast majority of the
195 standard library is in the root package, as are many small, standalone
196 third-party modules that don't belong to a larger module collection.
197 Unlike regular packages, modules in the root package can be found in
198 many directories: in fact, every directory listed in \code{sys.path}
199 can contribute modules to the root package.
Greg Ward16aafcd2000-04-09 04:06:44 +0000200\end{description}
201
202
203\subsection{Distutils-specific terminology}
Greg Warde78298a2000-04-28 17:12:24 +0000204\label{distutils-term}
Greg Ward16aafcd2000-04-09 04:06:44 +0000205
206The following terms apply more specifically to the domain of
207distributing Python modules using the Distutils:
208\begin{description}
209\item[module distribution] a collection of Python modules distributed
210 together as a single downloadable resource and meant to be installed
211 \emph{en masse}. Examples of some well-known module distributions are
212 Numeric Python, PyXML, PIL (the Python Imaging Library), or
213 mxDateTime. (This would be called a \emph{package}, except that term
Greg Ward59d382e2000-05-26 01:04:47 +0000214 is already taken in the Python context: a single module distribution
215 may contain zero, one, or many Python packages.)
Greg Ward16aafcd2000-04-09 04:06:44 +0000216\item[pure module distribution] a module distribution that contains only
217 pure Python modules and packages. Sometimes referred to as a ``pure
218 distribution.''
219\item[non-pure module distribution] a module distribution that contains
220 at least one extension module. Sometimes referred to as a ``non-pure
221 distribution.''
222\item[distribution root] the top-level directory of your source tree (or
223 source distribution); the directory where \file{setup.py} exists and
224 is run from
225\end{description}
226
227
228\section{Writing the Setup Script}
Greg Warde78298a2000-04-28 17:12:24 +0000229\label{setup-script}
Greg Ward16aafcd2000-04-09 04:06:44 +0000230
231The setup script is the centre of all activity in building,
232distributing, and installing modules using the Distutils. The main
233purpose of the setup script is to describe your module distribution to
Greg Wardd5767a52000-04-19 22:48:09 +0000234the Distutils, so that the various commands that operate on your modules
Greg Ward59d382e2000-05-26 01:04:47 +0000235do the right thing. As we saw in section~\ref{simple-example} above,
236the setup script consists mainly of a call to \function{setup()}, and
Greg Ward1bbe3292000-06-25 03:14:13 +0000237most information supplied to the Distutils by the module developer is
238supplied as keyword arguments to \function{setup()}.
Greg Ward16aafcd2000-04-09 04:06:44 +0000239
240Here's a slightly more involved example, which we'll follow for the next
241couple of sections: the Distutils' own setup script. (Keep in mind that
Greg Ward1d8f57a2000-08-05 00:43:11 +0000242although the Distutils are included with Python 1.6 and later, they also
243have an independent existence so that Python 1.5.2 users can use them to
244install other module distributions. The Distutils' own setup script,
245shown here, is used to install the package into Python 1.5.2.)
Greg Ward16aafcd2000-04-09 04:06:44 +0000246
247\begin{verbatim}
248#!/usr/bin/env python
249
250from distutils.core import setup
251
252setup (name = "Distutils",
253 version = "1.0",
Greg Ward1d8f57a2000-08-05 00:43:11 +0000254 description = "Python Distribution Utilities",
Greg Ward16aafcd2000-04-09 04:06:44 +0000255 author = "Greg Ward",
256 author_email = "gward@python.net",
257 url = "http://www.python.org/sigs/distutils-sig/",
258
259 packages = ['distutils', 'distutils.command'],
260 )
261\end{verbatim}
262There are only two differences between this and the trivial one-file
Greg Warde78298a2000-04-28 17:12:24 +0000263distribution presented in section~\ref{simple-example}: more
Greg Ward16aafcd2000-04-09 04:06:44 +0000264meta-data, and the specification of pure Python modules by package,
265rather than by module. This is important since the Distutils consist of
266a couple of dozen modules split into (so far) two packages; an explicit
267list of every module would be tedious to generate and difficult to
268maintain.
269
Greg Ward46b98e32000-04-14 01:53:36 +0000270Note that any pathnames (files or directories) supplied in the setup
Fred Drakeeff9a872000-10-26 16:41:03 +0000271script should be written using the \UNIX{} convention, i.e.
Greg Ward46b98e32000-04-14 01:53:36 +0000272slash-separated. The Distutils will take care of converting this
Greg Ward59d382e2000-05-26 01:04:47 +0000273platform-neutral representation into whatever is appropriate on your
Greg Ward46b98e32000-04-14 01:53:36 +0000274current platform before actually using the pathname. This makes your
275setup script portable across operating systems, which of course is one
276of the major goals of the Distutils. In this spirit, all pathnames in
Fred Drakeeff9a872000-10-26 16:41:03 +0000277this document are slash-separated (MacOS programmers should keep in
Greg Ward59d382e2000-05-26 01:04:47 +0000278mind that the \emph{absence} of a leading slash indicates a relative
Fred Drakeeff9a872000-10-26 16:41:03 +0000279path, the opposite of the MacOS convention with colons).
Greg Ward46b98e32000-04-14 01:53:36 +0000280
Thomas Heller5f52f722001-02-19 17:48:03 +0000281This, of course, only applies to pathnames given to Distutils functions.
282If you, for example, use standard python functions such as glob.glob
283or os.listdir to specify files, you should be careful to write portable
284code instead of hardcoding path separators:
285\begin{verbatim}
286 glob.glob(os.path.join('mydir', 'subdir', '*.html'))
287 os.listdir(os.path.join('mydir', 'subdir'))
288\end{verbatim}
Greg Ward16aafcd2000-04-09 04:06:44 +0000289
Greg Ward2afffd42000-08-06 20:37:24 +0000290\subsection{Listing whole packages}
291\label{listing-packages}
Greg Ward16aafcd2000-04-09 04:06:44 +0000292
293The \option{packages} option tells the Distutils to process (build,
294distribute, install, etc.) all pure Python modules found in each package
295mentioned in the \option{packages} list. In order to do this, of
296course, there has to be a correspondence between package names and
297directories in the filesystem. The default correspondence is the most
Greg Ward1ecc2512000-04-19 22:36:24 +0000298obvious one, i.e. package \module{distutils} is found in the directory
Greg Ward16aafcd2000-04-09 04:06:44 +0000299\file{distutils} relative to the distribution root. Thus, when you say
300\code{packages = ['foo']} in your setup script, you are promising that
301the Distutils will find a file \file{foo/\_\_init\_\_.py} (which might
302be spelled differently on your system, but you get the idea) relative to
303the directory where your setup script lives. (If you break this
304promise, the Distutils will issue a warning but process the broken
305package anyways.)
306
307If you use a different convention to lay out your source directory,
308that's no problem: you just have to supply the \option{package\_dir}
309option to tell the Distutils about your convention. For example, say
Greg Ward1d8f57a2000-08-05 00:43:11 +0000310you keep all Python source under \file{lib}, so that modules in the
311``root package'' (i.e., not in any package at all) are right in
312\file{lib}, modules in the \module{foo} package are in \file{lib/foo},
313and so forth. Then you would put
Greg Ward16aafcd2000-04-09 04:06:44 +0000314\begin{verbatim}
315package_dir = {'': 'lib'}
316\end{verbatim}
317in your setup script. (The keys to this dictionary are package names,
Greg Ward1d8f57a2000-08-05 00:43:11 +0000318and an empty package name stands for the root package. The values are
319directory names relative to your distribution root.) In this case, when
320you say \code{packages = ['foo']}, you are promising that the file
Greg Ward16aafcd2000-04-09 04:06:44 +0000321\file{lib/foo/\_\_init\_\_.py} exists.
322
Greg Ward1ecc2512000-04-19 22:36:24 +0000323Another possible convention is to put the \module{foo} package right in
324\file{lib}, the \module{foo.bar} package in \file{lib/bar}, etc. This
Greg Ward16aafcd2000-04-09 04:06:44 +0000325would be written in the setup script as
326\begin{verbatim}
327package_dir = {'foo': 'lib'}
328\end{verbatim}
Greg Ward59d382e2000-05-26 01:04:47 +0000329A \code{\var{package}: \var{dir}} entry in the \option{package\_dir}
330dictionary implicitly applies to all packages below \var{package}, so
331the \module{foo.bar} case is automatically handled here. In this
332example, having \code{packages = ['foo', 'foo.bar']} tells the Distutils
333to look for \file{lib/\_\_init\_\_.py} and
334\file{lib/bar/\_\_init\_\_.py}. (Keep in mind that although
335\option{package\_dir} applies recursively, you must explicitly list all
336packages in \option{packages}: the Distutils will \emph{not} recursively
337scan your source tree looking for any directory with an
338\file{\_\_init\_\_.py} file.)
Greg Ward16aafcd2000-04-09 04:06:44 +0000339
340
341\subsection{Listing individual modules}
Greg Warde78298a2000-04-28 17:12:24 +0000342\label{listing-modules}
Greg Ward16aafcd2000-04-09 04:06:44 +0000343
344For a small module distribution, you might prefer to list all modules
345rather than listing packages---especially the case of a single module
346that goes in the ``root package'' (i.e., no package at all). This
Greg Warde78298a2000-04-28 17:12:24 +0000347simplest case was shown in section~\ref{simple-example}; here is a
Greg Ward16aafcd2000-04-09 04:06:44 +0000348slightly more involved example:
349\begin{verbatim}
350py_modules = ['mod1', 'pkg.mod2']
351\end{verbatim}
352This describes two modules, one of them in the ``root'' package, the
Greg Wardd5767a52000-04-19 22:48:09 +0000353other in the \module{pkg} package. Again, the default package/directory
354layout implies that these two modules can be found in \file{mod1.py} and
355\file{pkg/mod2.py}, and that \file{pkg/\_\_init\_\_.py} exists as well.
Greg Ward2afffd42000-08-06 20:37:24 +0000356And again, you can override the package/directory correspondence using
357the \option{package\_dir} option.
Greg Ward59d382e2000-05-26 01:04:47 +0000358
359
360\subsection{Describing extension modules}
Greg Ward1365a302000-08-31 14:47:05 +0000361\label{describing-extensions}
Greg Ward59d382e2000-05-26 01:04:47 +0000362
Greg Ward2afffd42000-08-06 20:37:24 +0000363Just as writing Python extension modules is a bit more complicated than
364writing pure Python modules, describing them to the Distutils is a bit
365more complicated. Unlike pure modules, it's not enough just to list
366modules or packages and expect the Distutils to go out and find the
367right files; you have to specify the extension name, source file(s), and
368any compile/link requirements (include directories, libraries to link
369with, etc.).
370
371All of this is done through another keyword argument to
372\function{setup()}, the \option{extensions} option. \option{extensions}
373is just a list of \class{Extension} instances, each of which describes a
374single extension module. Suppose your distribution includes a single
375extension, called \module{foo} and implemented by \file{foo.c}. If no
376additional instructions to the compiler/linker are needed, describing
377this extension is quite simple:
378\begin{verbatim}
379Extension("foo", ["foo.c"])
380\end{verbatim}
381The \class{Extension} class can be imported from
382\module{distutils.core}, along with \function{setup()}. Thus, the setup
383script for a module distribution that contains only this one extension
384and nothing else might be:
385\begin{verbatim}
386from distutils.core import setup, Extension
387setup(name = "foo", version = "1.0",
Greg Ward078fc082000-09-12 23:08:53 +0000388 ext_modules = [Extension("foo", ["foo.c"])])
Greg Ward2afffd42000-08-06 20:37:24 +0000389\end{verbatim}
390
391The \class{Extension} class (actually, the underlying extension-building
Andrew M. Kuchlingda23c4f2001-02-17 00:38:48 +0000392machinery implemented by the \command{build\_ext} command) supports a
Greg Ward2afffd42000-08-06 20:37:24 +0000393great deal of flexibility in describing Python extensions, which is
394explained in the following sections.
395
396
397\subsubsection{Extension names and packages}
398
399The first argument to the \class{Extension} constructor is always the
400name of the extension, including any package names. For example,
401\begin{verbatim}
402Extension("foo", ["src/foo1.c", "src/foo2.c"])
403\end{verbatim}
404describes an extension that lives in the root package, while
405\begin{verbatim}
406Extension("pkg.foo", ["src/foo1.c", "src/foo2.c"])
407\end{verbatim}
408describes the same extension in the \module{pkg} package. The source
409files and resulting object code are identical in both cases; the only
410difference is where in the filesystem (and therefore where in Python's
411namespace hierarchy) the resulting extension lives.
412
413If you have a number of extensions all in the same package (or all under
414the same base package), use the \option{ext\_package} keyword argument
415to \function{setup()}. For example,
416\begin{verbatim}
417setup(...
418 ext_package = "pkg",
Greg Ward078fc082000-09-12 23:08:53 +0000419 ext_modules = [Extension("foo", ["foo.c"]),
420 Extension("subpkg.bar", ["bar.c"])]
Greg Ward2afffd42000-08-06 20:37:24 +0000421 )
422\end{verbatim}
423will compile \file{foo.c} to the extension \module{pkg.foo}, and
424\file{bar.c} to \module{pkg.subpkg.bar}.
425
426
427\subsubsection{Extension source files}
428
429The second argument to the \class{Extension} constructor is a list of
430source files. Since the Distutils currently only support C/C++
431extensions, these are normally C/C++ source files. (Be sure to use
432appropriate extensions to distinguish C++ source files: \file{.cc} and
Fred Drakeeff9a872000-10-26 16:41:03 +0000433\file{.cpp} seem to be recognized by both \UNIX{} and Windows compilers.)
Greg Ward2afffd42000-08-06 20:37:24 +0000434
435However, you can also include SWIG interface (\file{.i}) files in the
436list; the \command{build\_ext} command knows how to deal with SWIG
437extensions: it will run SWIG on the interface file and compile the
438resulting C/C++ file into your extension.
439
440\XXX{SWIG support is rough around the edges and largely untested;
441 especially SWIG support of C++ extensions! Explain in more detail
442 here when the interface firms up.}
443
444On some platforms, you can include non-source files that are processed
445by the compiler and included in your extension. Currently, this just
Thomas Heller5f52f722001-02-19 17:48:03 +0000446means Windows message text (\file{.mc}) files and resource definition
447(\file{.rc}) files for Visual C++. These will be compiled to binary resource
448(\file{.res}) files and linked into the executable.
Greg Ward2afffd42000-08-06 20:37:24 +0000449
450
451\subsubsection{Preprocessor options}
452
453Three optional arguments to \class{Extension} will help if you need to
454specify include directories to search or preprocessor macros to
455define/undefine: \code{include\_dirs}, \code{define\_macros}, and
456\code{undef\_macros}.
457
458For example, if your extension requires header files in the
459\file{include} directory under your distribution root, use the
460\code{include\_dirs} option:
461\begin{verbatim}
462Extension("foo", ["foo.c"], include_dirs=["include"])
463\end{verbatim}
464
465You can specify absolute directories there; if you know that your
Fred Drakeeff9a872000-10-26 16:41:03 +0000466extension will only be built on \UNIX{} systems with X11R6 installed to
Greg Ward2afffd42000-08-06 20:37:24 +0000467\file{/usr}, you can get away with
468\begin{verbatim}
469Extension("foo", ["foo.c"], include_dirs=["/usr/include/X11"])
470\end{verbatim}
471You should avoid this sort of non-portable usage if you plan to
472distribute your code: it's probably better to write your code to include
473(e.g.) \code{<X11/Xlib.h>}.
474
475If you need to include header files from some other Python extension,
476you can take advantage of the fact that the Distutils install extension
477header files in a consistent way. For example, the Numerical Python
Fred Drakeeff9a872000-10-26 16:41:03 +0000478header files are installed (on a standard \UNIX{} installation) to
Greg Ward2afffd42000-08-06 20:37:24 +0000479\file{/usr/local/include/python1.5/Numerical}. (The exact location will
480differ according to your platform and Python installation.) Since the
481Python include directory---\file{/usr/local/include/python1.5} in this
482case---is always included in the search path when building Python
483extensions, the best approach is to include (e.g.)
484\code{<Numerical/arrayobject.h>}. If you insist on putting the
485\file{Numerical} include directory right into your header search path,
486though, you can find that directory using the Distutils
487\module{sysconfig} module:
488\begin{verbatim}
489from distutils.sysconfig import get_python_inc
490incdir = os.path.join(get_python_inc(plat_specific=1), "Numerical")
491setup(...,
492 Extension(..., include_dirs=[incdir]))
493\end{verbatim}
494Even though this is quite portable---it will work on any Python
495installation, regardless of platform---it's probably easier to just
496write your C code in the sensible way.
497
498You can define and undefine pre-processor macros with the
499\code{define\_macros} and \code{undef\_macros} options.
500\code{define\_macros} takes a list of \code{(name, value)} tuples, where
501\code{name} is the name of the macro to define (a string) and
502\code{value} is its value: either a string or \code{None}. (Defining a
503macro \code{FOO} to \code{None} is the equivalent of a bare
504\code{\#define FOO} in your C source: with most compilers, this sets
505\code{FOO} to the string \code{1}.) \code{undef\_macros} is just
506a list of macros to undefine.
507
508For example:
509\begin{verbatim}
510Extension(...,
511 define_macros=[('NDEBUG', '1')],
512 ('HAVE_STRFTIME', None),
513 undef_macros=['HAVE_FOO', 'HAVE_BAR'])
514\end{verbatim}
515is the equivalent of having this at the top of every C source file:
516\begin{verbatim}
517#define NDEBUG 1
518#define HAVE_STRFTIME
519#undef HAVE_FOO
520#undef HAVE_BAR
521\end{verbatim}
522
523
524\subsubsection{Library options}
525
526You can also specify the libraries to link against when building your
527extension, and the directories to search for those libraries. The
528\code{libraries} option is a list of libraries to link against,
529\code{library\_dirs} is a list of directories to search for libraries at
530link-time, and \code{runtime\_library\_dirs} is a list of directories to
531search for shared (dynamically loaded) libraries at run-time.
532
533For example, if you need to link against libraries known to be in the
534standard library search path on target systems
535\begin{verbatim}
536Extension(...,
537 libraries=["gdbm", "readline"])
538\end{verbatim}
539
540If you need to link with libraries in a non-standard location, you'll
541have to include the location in \code{library\_dirs}:
542\begin{verbatim}
543Extension(...,
544 library_dirs=["/usr/X11R6/lib"],
545 libraries=["X11", "Xt"])
546\end{verbatim}
547(Again, this sort of non-portable construct should be avoided if you
548intend to distribute your code.)
549
Thomas Heller5f52f722001-02-19 17:48:03 +0000550\XXX{Should mention clib libraries here or somewhere else!}
551
552\subsubsection{Other options}
553
554There are still some other options which can be used to handle special
555cases.
556
557The \option{extra\_objects} option is a list of object files to be passed
558to the linker. These files must not have extensions, as the default
559extension for the compiler is used.
560
561\option{extra\_compile\_args} and \option{extra\_link\_args} can be used
562to specify additional command line options for the compiler resp.
563the linker command line.
564
565\option{export\_symbols} is only useful on windows, it can contain a list
566of symbols (functions or variables) to be exported. This option
567is not needed when building compiled extensions: the \code{initmodule}
568function will automatically be added to the exported symbols list
569by Distutils.
570
571\subsection{Listing scripts}
572So far we have been dealing with pure and non-pure Python modules,
573which are usually not run by themselves but imported by scripts.
574
575Scripts are files containing Python source code, indended to be started
576from the command line.
577Distutils doesn't provide much functionality for the scripts: the only
578support Distutils gives is to adjust the first line of the script
579if it starts with \code{#!} and contains the word ``python'' to refer
580to the current interpreter location.
581
582The \option{scripts} option simply is a list of files to be handled
583in this way.
584
585
586\subsection{Listing additional files}
587The \option{data\_files} option can be used to specify additional
588files needed by the module distribution: configuration files,
589data files, anything which does not fit in the previous categories.
590
591\option{data\_files} specify a sequence of \code{(directory, files)}
592pairs in the following way:
593\begin{verbatim}
594setup(...
595 data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
596 ('config', ['cfg/data.cfg'])])
597\end{verbatim}
598
599Note that you can specify the directory names where the data files
600will be installed, but you cannot rename the data files themselves.
601
602You can specify the \option{data\_files} options as a simple sequence
603of files without specifying a target directory, but this is not recommended,
604and the \command{install} command will print a warning in this case.
605To install data files directly in the target directory, an empty
606string should be given as the directory.
Greg Ward16aafcd2000-04-09 04:06:44 +0000607
608
609\section{Writing the Setup Configuration File}
Greg Warde78298a2000-04-28 17:12:24 +0000610\label{setup-config}
Greg Ward16aafcd2000-04-09 04:06:44 +0000611
Greg Ward16aafcd2000-04-09 04:06:44 +0000612Often, it's not possible to write down everything needed to build a
Greg Ward47f99a62000-09-04 20:07:15 +0000613distribution \emph{a priori}: you may need to get some information from
614the user, or from the user's system, in order to proceed. As long as
615that information is fairly simple---a list of directories to search for
616C header files or libraries, for example---then providing a
617configuration file, \file{setup.cfg}, for users to edit is a cheap and
618easy way to solicit it. Configuration files also let you provide
619default values for any command option, which the installer can then
620override either on the command-line or by editing the config file.
Greg Ward16aafcd2000-04-09 04:06:44 +0000621
Greg Ward47f99a62000-09-04 20:07:15 +0000622(If you have more advanced needs, such as determining which extensions
623to build based on what capabilities are present on the target system,
624then you need the Distutils ``auto-configuration'' facility. This
625started to appear in Distutils 0.9 but, as of this writing, isn't mature
626or stable enough yet for real-world use.)
Greg Ward16aafcd2000-04-09 04:06:44 +0000627
Greg Ward47f99a62000-09-04 20:07:15 +0000628\XXX{should reference description of distutils config files in
629 ``Installing'' manual here}
630
631The setup configuration file is a useful middle-ground between the setup
632script---which, ideally, would be opaque to installers\footnote{This
633 ideal probably won't be achieved until auto-configuration is fully
634 supported by the Distutils.}---and the command-line to the setup
635script, which is outside of your control and entirely up to the
636installer. In fact, \file{setup.cfg} (and any other Distutils
637configuration files present on the target system) are processed after
638the contents of the setup script, but before the command-line. This has
639several useful consequences:
640\begin{itemize}
641\item installers can override some of what you put in \file{setup.py} by
642 editing \file{setup.cfg}
643\item you can provide non-standard defaults for options that are not
644 easily set in \file{setup.py}
645\item installers can override anything in \file{setup.cfg} using the
646 command-line options to \file{setup.py}
647\end{itemize}
648
649The basic syntax of the configuration file is simple:
650\begin{verbatim}
651[command]
652option=value
653...
654\end{verbatim}
655where \var{command} is one of the Distutils commands (e.g.
656\command{build\_py}, \command{install}), and \var{option} is one of the
657options that command supports. Any number of options can be supplied
658for each command, and any number of command sections can be included in
Fred Drake78489a32000-11-22 16:06:16 +0000659the file. Blank lines are ignored, as are comments (from a
660\character{\#} character to end-of-line). Long option values can be
661split across multiple lines simply by indenting the continuation lines.
Greg Ward47f99a62000-09-04 20:07:15 +0000662
663You can find out the list of options supported by a particular command
664with the universal \longprogramopt{help} option, e.g.
665\begin{verbatim}
666> python setup.py --help build_ext
667[...]
668Options for 'build_ext' command:
669 --build-lib (-b) directory for compiled extension modules
670 --build-temp (-t) directory for temporary files (build by-products)
671 --inplace (-i) ignore build-lib and put compiled extensions into the
672 source directory alongside your pure Python modules
673 --include-dirs (-I) list of directories to search for header files
674 --define (-D) C preprocessor macros to define
675 --undef (-U) C preprocessor macros to undefine
676[...]
677\end{verbatim}
678Or consult section \ref{reference} of this document (the command
679reference).
680
681Note that an option spelled \longprogramopt{foo-bar} on the command-line
682is spelled \option{foo\_bar} in configuration files.
683
684For example, say you want your extensions to be built
685``in-place''---that is, you have an extension \module{pkg.ext}, and you
Fred Drakeeff9a872000-10-26 16:41:03 +0000686want the compiled extension file (\file{ext.so} on \UNIX, say) to be put
Greg Ward47f99a62000-09-04 20:07:15 +0000687in the same source directory as your pure Python modules
688\module{pkg.mod1} and \module{pkg.mod2}. You can always use the
689\longprogramopt{inplace} option on the command-line to ensure this:
690\begin{verbatim}
691python setup.py build_ext --inplace
692\end{verbatim}
693But this requires that you always specify the \command{build\_ext}
694command explicitly, and remember to provide \longprogramopt{inplace}.
695An easier way is to ``set and forget'' this option, by encoding it in
696\file{setup.cfg}, the configuration file for this distribution:
697\begin{verbatim}
698[build_ext]
699inplace=1
700\end{verbatim}
701This will affect all builds of this module distribution, whether or not
702you explcitly specify \command{build\_ext}. If you include
703\file{setup.cfg} in your source distribution, it will also affect
704end-user builds---which is probably a bad idea for this option, since
705always building extensions in-place would break installation of the
706module distribution. In certain peculiar cases, though, modules are
707built right in their installation directory, so this is conceivably a
708useful ability. (Distributing extensions that expect to be built in
709their installation directory is almost always a bad idea, though.)
710
711Another example: certain commands take a lot of options that don't
712change from run-to-run; for example, \command{bdist\_rpm} needs to know
713everything required to generate a ``spec'' file for creating an RPM
714distribution. Some of this information comes from the setup script, and
715some is automatically generated by the Distutils (such as the list of
716files installed). But some of it has to be supplied as options to
717\command{bdist\_rpm}, which would be very tedious to do on the
718command-line for every run. Hence, here is a snippet from the
719Distutils' own \file{setup.cfg}:
720\begin{verbatim}
721[bdist_rpm]
722release = 1
723packager = Greg Ward <gward@python.net>
724doc_files = CHANGES.txt
725 README.txt
726 USAGE.txt
727 doc/
728 examples/
729\end{verbatim}
730Note that the \option{doc\_files} option is simply a
731whitespace-separated string split across multiple lines for readability.
Greg Ward16aafcd2000-04-09 04:06:44 +0000732
733
734\section{Creating a Source Distribution}
Greg Warde78298a2000-04-28 17:12:24 +0000735\label{source-dist}
Greg Ward16aafcd2000-04-09 04:06:44 +0000736
Greg Warde78298a2000-04-28 17:12:24 +0000737As shown in section~\ref{simple-example}, you use the
Greg Ward16aafcd2000-04-09 04:06:44 +0000738\command{sdist} command to create a source distribution. In the
739simplest case,
740\begin{verbatim}
741python setup.py sdist
742\end{verbatim}
Greg Ward19c67f82000-06-24 01:33:16 +0000743(assuming you haven't specified any \command{sdist} options in the setup
744script or config file), \command{sdist} creates the archive of the
Greg Ward54589d42000-09-06 01:37:35 +0000745default format for the current platform. The default format is gzip'ed
Fred Drakeeff9a872000-10-26 16:41:03 +0000746tar file (\file{.tar.gz}) on \UNIX, and ZIP file on Windows.
747\XXX{no MacOS support here}
Greg Ward54589d42000-09-06 01:37:35 +0000748
Greg Wardd5767a52000-04-19 22:48:09 +0000749You can specify as many formats as you like using the
750\longprogramopt{formats} option, for example:
Greg Ward16aafcd2000-04-09 04:06:44 +0000751\begin{verbatim}
752python setup.py sdist --formats=gztar,zip
753\end{verbatim}
754to create a gzipped tarball and a zip file. The available formats are:
Greg Ward46b98e32000-04-14 01:53:36 +0000755\begin{tableiii}{l|l|c}{code}%
756 {Format}{Description}{Notes}
Greg Ward54589d42000-09-06 01:37:35 +0000757 \lineiii{zip}{zip file (\file{.zip})}{(1),(3)}
758 \lineiii{gztar}{gzip'ed tar file (\file{.tar.gz})}{(2),(4)}
Greg Ward47f99a62000-09-04 20:07:15 +0000759 \lineiii{bztar}{bzip2'ed tar file (\file{.tar.gz})}{(4)}
760 \lineiii{ztar}{compressed tar file (\file{.tar.Z})}{(4)}
Greg Ward54589d42000-09-06 01:37:35 +0000761 \lineiii{tar}{tar file (\file{.tar})}{(4)}
Greg Ward46b98e32000-04-14 01:53:36 +0000762\end{tableiii}
763
764\noindent Notes:
765\begin{description}
766\item[(1)] default on Windows
Fred Drakeeff9a872000-10-26 16:41:03 +0000767\item[(2)] default on \UNIX
Greg Wardb6528972000-09-07 02:40:37 +0000768\item[(3)] requires either external \program{zip} utility or
769 \module{zipfile} module (not part of the standard Python library)
Greg Ward47f99a62000-09-04 20:07:15 +0000770\item[(4)] requires external utilities: \program{tar} and possibly one
771 of \program{gzip}, \program{bzip2}, or \program{compress}
Greg Ward46b98e32000-04-14 01:53:36 +0000772\end{description}
Greg Ward16aafcd2000-04-09 04:06:44 +0000773
774
Greg Ward54589d42000-09-06 01:37:35 +0000775
776\subsection{Specifying the files to distribute}
Greg Warde78298a2000-04-28 17:12:24 +0000777\label{manifest}
Greg Ward16aafcd2000-04-09 04:06:44 +0000778
Greg Ward54589d42000-09-06 01:37:35 +0000779If you don't supply an explicit list of files (or instructions on how to
780generate one), the \command{sdist} command puts a minimal default set
781into the source distribution:
Greg Ward16aafcd2000-04-09 04:06:44 +0000782\begin{itemize}
Greg Wardfacb8db2000-04-09 04:32:40 +0000783\item all Python source files implied by the \option{py\_modules} and
Greg Ward16aafcd2000-04-09 04:06:44 +0000784 \option{packages} options
Greg Wardfacb8db2000-04-09 04:32:40 +0000785\item all C source files mentioned in the \option{ext\_modules} or
Greg Ward16aafcd2000-04-09 04:06:44 +0000786 \option{libraries} options (\XXX{getting C library sources currently
Greg Wardfacb8db2000-04-09 04:32:40 +0000787 broken -- no get\_source\_files() method in build\_clib.py!})
Greg Ward16aafcd2000-04-09 04:06:44 +0000788\item anything that looks like a test script: \file{test/test*.py}
789 (currently, the Distutils don't do anything with test scripts except
790 include them in source distributions, but in the future there will be
791 a standard for testing Python module distributions)
Greg Ward54589d42000-09-06 01:37:35 +0000792\item \file{README.txt} (or \file{README}), \file{setup.py} (or whatever
793 you called your setup script), and \file{setup.cfg}
Greg Ward16aafcd2000-04-09 04:06:44 +0000794\end{itemize}
795Sometimes this is enough, but usually you will want to specify
796additional files to distribute. The typical way to do this is to write
797a \emph{manifest template}, called \file{MANIFEST.in} by default. The
Greg Ward54589d42000-09-06 01:37:35 +0000798manifest template is just a list of instructions for how to generate
799your manifest file, \file{MANIFEST}, which is the exact list of files to
800include in your source distribution. The \command{sdist} command
801processes this template and generates a manifest based on its
802instructions and what it finds in the filesystem.
803
804If you prefer to roll your own manifest file, the format is simple: one
805filename per line, regular files (or symlinks to them) only. If you do
806supply your own \file{MANIFEST}, you must specify everything: the
807default set of files described above does not apply in this case.
Greg Ward16aafcd2000-04-09 04:06:44 +0000808
809The manifest template has one command per line, where each command
810specifies a set of files to include or exclude from the source
811distribution. For an example, again we turn to the Distutils' own
812manifest template:
813\begin{verbatim}
814include *.txt
Greg Ward87da1ea2000-04-21 04:35:25 +0000815recursive-include examples *.txt *.py
Greg Ward16aafcd2000-04-09 04:06:44 +0000816prune examples/sample?/build
817\end{verbatim}
818The meanings should be fairly clear: include all files in the
819distribution root matching \code{*.txt}, all files anywhere under the
820\file{examples} directory matching \code{*.txt} or \code{*.py}, and
Greg Ward54589d42000-09-06 01:37:35 +0000821exclude all directories matching \code{examples/sample?/build}. All of
822this is done \emph{after} the standard include set, so you can exclude
823files from the standard set with explicit instructions in the manifest
824template. (Or, you can use the \longprogramopt{no-defaults} option to
825disable the standard set entirely.) There are several other commands
826available in the manifest template mini-language; see
827section~\ref{sdist-cmd}.
Greg Ward16aafcd2000-04-09 04:06:44 +0000828
Greg Ward54589d42000-09-06 01:37:35 +0000829The order of commands in the manifest template matters: initially, we
830have the list of default files as described above, and each command in
831the template adds to or removes from that list of files. Once we have
832fully processed the manifest template, we remove files that should not
833be included in the source distribution:
834\begin{itemize}
835\item all files in the Distutils ``build'' tree (default \file{build/})
836\item all files in directories named \file{RCS} or \file{CVS}
837\end{itemize}
838Now we have our complete list of files, which is written to the manifest
839for future reference, and then used to build the source distribution
840archive(s).
841
842You can disable the default set of included files with the
843\longprogramopt{no-defaults} option, and you can disable the standard
844exclude set with \longprogramopt{no-prune}.
Greg Ward16aafcd2000-04-09 04:06:44 +0000845
Greg Ward46b98e32000-04-14 01:53:36 +0000846Following the Distutils' own manifest template, let's trace how the
Greg Ward47f99a62000-09-04 20:07:15 +0000847\command{sdist} command builds the list of files to include in the
Greg Ward46b98e32000-04-14 01:53:36 +0000848Distutils source distribution:
Greg Ward16aafcd2000-04-09 04:06:44 +0000849\begin{enumerate}
850\item include all Python source files in the \file{distutils} and
851 \file{distutils/command} subdirectories (because packages
852 corresponding to those two directories were mentioned in the
Greg Ward54589d42000-09-06 01:37:35 +0000853 \option{packages} option in the setup script---see
854 section~\ref{setup-script})
855\item include \file{README.txt}, \file{setup.py}, and \file{setup.cfg}
856 (standard files)
857\item include \file{test/test*.py} (standard files)
Greg Ward16aafcd2000-04-09 04:06:44 +0000858\item include \file{*.txt} in the distribution root (this will find
859 \file{README.txt} a second time, but such redundancies are weeded out
860 later)
Greg Ward54589d42000-09-06 01:37:35 +0000861\item include anything matching \file{*.txt} or \file{*.py} in the
862 sub-tree under \file{examples},
863\item exclude all files in the sub-trees starting at directories
864 matching \file{examples/sample?/build}---this may exclude files
865 included by the previous two steps, so it's important that the
866 \code{prune} command in the manifest template comes after the
867 \code{recursive-include} command
868\item exclude the entire \file{build} tree, and any \file{RCS} or
869 \file{CVS} directories
Greg Wardfacb8db2000-04-09 04:32:40 +0000870\end{enumerate}
Greg Ward46b98e32000-04-14 01:53:36 +0000871Just like in the setup script, file and directory names in the manifest
872template should always be slash-separated; the Distutils will take care
873of converting them to the standard representation on your platform.
874That way, the manifest template is portable across operating systems.
875
Greg Ward16aafcd2000-04-09 04:06:44 +0000876
877\subsection{Manifest-related options}
Greg Warde78298a2000-04-28 17:12:24 +0000878\label{manifest-options}
Greg Ward16aafcd2000-04-09 04:06:44 +0000879
880The normal course of operations for the \command{sdist} command is as
881follows:
882\begin{itemize}
Greg Ward46b98e32000-04-14 01:53:36 +0000883\item if the manifest file, \file{MANIFEST} doesn't exist, read
884 \file{MANIFEST.in} and create the manifest
Greg Ward54589d42000-09-06 01:37:35 +0000885\item if neither \file{MANIFEST} nor \file{MANIFEST.in} exist, create a
886 manifest with just the default file set\footnote{In versions of the
887 Distutils up to and including 0.9.2 (Python 2.0b1), this feature was
888 broken; use the \programopt{-f} (\longprogramopt{force-manifest})
889 option to work around the bug.}
Greg Ward1d8f57a2000-08-05 00:43:11 +0000890\item if either \file{MANIFEST.in} or the setup script (\file{setup.py})
891 are more recent than \file{MANIFEST}, recreate \file{MANIFEST} by
892 reading \file{MANIFEST.in}
Greg Ward16aafcd2000-04-09 04:06:44 +0000893\item use the list of files now in \file{MANIFEST} (either just
894 generated or read in) to create the source distribution archive(s)
895\end{itemize}
Greg Ward54589d42000-09-06 01:37:35 +0000896There are a couple of options that modify this behaviour. First, use
897the \longprogramopt{no-defaults} and \longprogramopt{no-prune} to
898disable the standard ``include'' and ``exclude'' sets.\footnote{Note
899 that if you have no manifest template, no manifest, and use the
900 \longprogramopt{no-defaults}, you will get an empty manifest. Another
901 bug in Distutils 0.9.2 and earlier causes an uncaught exception in
902 this case. The workaround is: Don't Do That.}
Greg Ward16aafcd2000-04-09 04:06:44 +0000903
Greg Ward54589d42000-09-06 01:37:35 +0000904Second, you might want to force the manifest to be regenerated---for
Greg Ward16aafcd2000-04-09 04:06:44 +0000905example, if you have added or removed files or directories that match an
906existing pattern in the manifest template, you should regenerate the
907manifest:
908\begin{verbatim}
909python setup.py sdist --force-manifest
910\end{verbatim}
Greg Ward16aafcd2000-04-09 04:06:44 +0000911
912Or, you might just want to (re)generate the manifest, but not create a
913source distribution:
914\begin{verbatim}
915python setup.py sdist --manifest-only
916\end{verbatim}
Greg Ward54589d42000-09-06 01:37:35 +0000917\longprogramopt{manifest-only} implies \longprogramopt{force-manifest}.
918\programopt{-o} is a shortcut for \longprogramopt{manifest-only}, and
919\programopt{-f} for \longprogramopt{force-manifest}.
Greg Ward16aafcd2000-04-09 04:06:44 +0000920
921
922\section{Creating Built Distributions}
Greg Warde78298a2000-04-28 17:12:24 +0000923\label{built-dist}
Greg Ward16aafcd2000-04-09 04:06:44 +0000924
Greg Ward46b98e32000-04-14 01:53:36 +0000925A ``built distribution'' is what you're probably used to thinking of
926either as a ``binary package'' or an ``installer'' (depending on your
927background). It's not necessarily binary, though, because it might
928contain only Python source code and/or byte-code; and we don't call it a
929package, because that word is already spoken for in Python. (And
930``installer'' is a term specific to the Windows world. \XXX{do Mac
931 people use it?})
Greg Ward16aafcd2000-04-09 04:06:44 +0000932
Greg Ward46b98e32000-04-14 01:53:36 +0000933A built distribution is how you make life as easy as possible for
934installers of your module distribution: for users of RPM-based Linux
935systems, it's a binary RPM; for Windows users, it's an executable
936installer; for Debian-based Linux users, it's a Debian package; and so
937forth. Obviously, no one person will be able to create built
Greg Wardb6528972000-09-07 02:40:37 +0000938distributions for every platform under the sun, so the Distutils are
Greg Ward46b98e32000-04-14 01:53:36 +0000939designed to enable module developers to concentrate on their
940specialty---writing code and creating source distributions---while an
941intermediary species of \emph{packager} springs up to turn source
Greg Ward19c67f82000-06-24 01:33:16 +0000942distributions into built distributions for as many platforms as there
Greg Ward46b98e32000-04-14 01:53:36 +0000943are packagers.
944
945Of course, the module developer could be his own packager; or the
946packager could be a volunteer ``out there'' somewhere who has access to
947a platform which the original developer does not; or it could be
948software periodically grabbing new source distributions and turning them
949into built distributions for as many platforms as the software has
950access to. Regardless of the nature of the beast, a packager uses the
951setup script and the \command{bdist} command family to generate built
952distributions.
953
954As a simple example, if I run the following command in the Distutils
955source tree:
956\begin{verbatim}
957python setup.py bdist
958\end{verbatim}
959then the Distutils builds my module distribution (the Distutils itself
960in this case), does a ``fake'' installation (also in the \file{build}
961directory), and creates the default type of built distribution for my
Greg Wardb6528972000-09-07 02:40:37 +0000962platform. The default format for built distributions is a ``dumb'' tar
Fred Drakeeff9a872000-10-26 16:41:03 +0000963file on \UNIX, and an simple executable installer on Windows. (That tar
Greg Wardb6528972000-09-07 02:40:37 +0000964file is considered ``dumb'' because it has to be unpacked in a specific
965location to work.)
Greg Ward1d8f57a2000-08-05 00:43:11 +0000966
Fred Drakeeff9a872000-10-26 16:41:03 +0000967Thus, the above command on a \UNIX{} system creates
Greg Ward1d8f57a2000-08-05 00:43:11 +0000968\file{Distutils-0.9.1.\filevar{plat}.tar.gz}; unpacking this tarball
Greg Wardb6528972000-09-07 02:40:37 +0000969from the right place installs the Distutils just as though you had
970downloaded the source distribution and run \code{python setup.py
971 install}. (The ``right place'' is either the root of the filesystem or
972Python's \filevar{prefix} directory, depending on the options given to
973the \command{bdist\_dumb} command; the default is to make dumb
974distributions relative to \filevar{prefix}.)
Greg Ward46b98e32000-04-14 01:53:36 +0000975
Greg Wardb6528972000-09-07 02:40:37 +0000976Obviously, for pure Python distributions, this isn't a huge win---but
977for non-pure distributions, which include extensions that would need to
978be compiled, it can mean the difference between someone being able to
979use your extensions or not. And creating ``smart'' built distributions,
980such as an RPM package or an executable installer for Windows, is a big
981win for users even if your distribution doesn't include any extensions.
Greg Ward46b98e32000-04-14 01:53:36 +0000982
Greg Wardb6528972000-09-07 02:40:37 +0000983The \command{bdist} command has a \longprogramopt{formats} option,
Greg Ward1d8f57a2000-08-05 00:43:11 +0000984similar to the \command{sdist} command, which you can use to select the
985types of built distribution to generate: for example,
Greg Ward46b98e32000-04-14 01:53:36 +0000986\begin{verbatim}
987python setup.py bdist --format=zip
988\end{verbatim}
Fred Drakeeff9a872000-10-26 16:41:03 +0000989would, when run on a \UNIX{} system, create
Greg Ward1d8f57a2000-08-05 00:43:11 +0000990\file{Distutils-0.8.\filevar{plat}.zip}---again, this archive would be
991unpacked from the root directory to install the Distutils.
Greg Ward46b98e32000-04-14 01:53:36 +0000992
993The available formats for built distributions are:
994\begin{tableiii}{l|l|c}{code}%
995 {Format}{Description}{Notes}
Greg Wardb6528972000-09-07 02:40:37 +0000996 \lineiii{gztar}{gzipped tar file (\file{.tar.gz})}{(1),(3)}
997 \lineiii{ztar}{compressed tar file (\file{.tar.Z})}{(3)}
998 \lineiii{tar}{tar file (\file{.tar})}{(3)}
999 \lineiii{zip}{zip file (\file{.zip})}{(4)}
1000 \lineiii{rpm}{RPM}{(5)}
1001 \lineiii{srpm}{source RPM}{(5) \XXX{to do!}}
Thomas Heller5f52f722001-02-19 17:48:03 +00001002 \lineiii{wininst}{self-extracting ZIP file for Windows}{(2),(4)}
Greg Ward46b98e32000-04-14 01:53:36 +00001003\end{tableiii}
1004
1005\noindent Notes:
1006\begin{description}
Fred Drakeeff9a872000-10-26 16:41:03 +00001007\item[(1)] default on \UNIX
Greg Ward1d8f57a2000-08-05 00:43:11 +00001008\item[(2)] default on Windows \XXX{to-do!}
Greg Wardb6528972000-09-07 02:40:37 +00001009\item[(3)] requires external utilities: \program{tar} and possibly one
1010 of \program{gzip}, \program{bzip2}, or \program{compress}
1011\item[(4)] requires either external \program{zip} utility or
1012 \module{zipfile} module (not part of the standard Python library)
1013\item[(5)] requires external \program{rpm} utility, version 3.0.4 or
1014 better (use \code{rpm --version} to find out which version you have)
Greg Ward46b98e32000-04-14 01:53:36 +00001015\end{description}
1016
1017You don't have to use the \command{bdist} command with the
Greg Wardd5767a52000-04-19 22:48:09 +00001018\longprogramopt{formats} option; you can also use the command that
Greg Ward1d8f57a2000-08-05 00:43:11 +00001019directly implements the format you're interested in. Some of these
Greg Ward46b98e32000-04-14 01:53:36 +00001020\command{bdist} ``sub-commands'' actually generate several similar
1021formats; for instance, the \command{bdist\_dumb} command generates all
1022the ``dumb'' archive formats (\code{tar}, \code{ztar}, \code{gztar}, and
1023\code{zip}), and \command{bdist\_rpm} generates both binary and source
1024RPMs. The \command{bdist} sub-commands, and the formats generated by
1025each, are:
1026\begin{tableii}{l|l}{command}%
1027 {Command}{Formats}
1028 \lineii{bdist\_dumb}{tar, ztar, gztar, zip}
1029 \lineii{bdist\_rpm}{rpm, srpm}
Greg Ward1d8f57a2000-08-05 00:43:11 +00001030 \lineii{bdist\_wininst}{wininst}
Greg Ward46b98e32000-04-14 01:53:36 +00001031\end{tableii}
Greg Ward16aafcd2000-04-09 04:06:44 +00001032
Greg Wardb6528972000-09-07 02:40:37 +00001033The following sections give details on the individual \command{bdist\_*}
1034commands.
1035
1036
1037\subsection{Creating dumb built distributions}
1038\label{creating-dumb}
1039
1040\XXX{Need to document absolute vs. prefix-relative packages here, but
1041 first I have to implement it!}
1042
1043
1044\subsection{Creating RPM packages}
1045\label{creating-rpms}
1046
1047The RPM format is used by many of popular Linux distributions, including
1048Red Hat, SuSE, and Mandrake. If one of these (or any of the other
1049RPM-based Linux distributions) is your usual environment, creating RPM
1050packages for other users of that same distribution is trivial.
1051Depending on the complexity of your module distribution and differences
1052between Linux distributions, you may also be able to create RPMs that
1053work on different RPM-based distributions.
1054
1055The usual way to create an RPM of your module distribution is to run the
1056\command{bdist\_rpm} command:
1057\begin{verbatim}
1058python setup.py bdist_rpm
1059\end{verbatim}
1060or the \command{bdist} command with the \longprogramopt{format} option:
1061\begin{verbatim}
1062python setup.py bdist --formats=rpm
1063\end{verbatim}
1064The former allows you to specify RPM-specific options; the latter allows
1065you to easily specify multiple formats in one run. If you need to do
1066both, you can explicitly specify multiple \command{bdist\_*} commands
1067and their options:
1068\begin{verbatim}
1069python setup.py bdist_rpm --packager="John Doe <jdoe@python.net>" \
1070 bdist_wininst --target_version="2.0"
1071\end{verbatim}
1072
1073Creating RPM packages is driven by a \file{.spec} file, much as using
1074the Distutils is driven by the setup script. To make your life easier,
1075the \command{bdist\_rpm} command normally creates a \file{.spec} file
1076based on the information you supply in the setup script, on the command
1077line, and in any Distutils configuration files. Various options and
Andrew M. Kuchlingda23c4f2001-02-17 00:38:48 +00001078sections in the \file{.spec} file are derived from options in the setup
Greg Wardb6528972000-09-07 02:40:37 +00001079script as follows:
1080\begin{tableii}{l|l}{textrm}%
1081 {RPM \file{.spec} file option or section}{Distutils setup script option}
1082 \lineii{Name}{\option{name}}
1083 \lineii{Summary (in preamble)}{\option{description}}
1084 \lineii{Version}{\option{version}}
1085 \lineii{Vendor}{\option{author} and \option{author\_email}, or \\&
1086 \option{maintainer} and \option{maintainer\_email}}
1087 \lineii{Copyright}{\option{licence}}
1088 \lineii{Url}{\option{url}}
1089 \lineii{\%description (section)}{\option{long\_description}}
1090\end{tableii}
1091
1092Additionally, there many options in \file{.spec} files that don't have
1093corresponding options in the setup script. Most of these are handled
1094through options to the \command{bdist\_rpm} command as follows:
1095\begin{tableiii}{l|l|l}{textrm}%
1096 {RPM \file{.spec} file option or section}%
1097 {\command{bdist\_rpm} option}%
1098 {default value}
1099 \lineiii{Release}{\option{release}}{``1''}
1100 \lineiii{Group}{\option{group}}{``Development/Libraries''}
1101 \lineiii{Vendor}{\option{vendor}}{(see above)}
Andrew M. Kuchlingda23c4f2001-02-17 00:38:48 +00001102 \lineiii{Packager}{\option{packager}}{(none)}
1103 \lineiii{Provides}{\option{provides}}{(none)}
1104 \lineiii{Requires}{\option{requires}}{(none)}
1105 \lineiii{Conflicts}{\option{conflicts}}{(none)}
1106 \lineiii{Obsoletes}{\option{obsoletes}}{(none)}
Greg Wardb6528972000-09-07 02:40:37 +00001107 \lineiii{Distribution}{\option{distribution\_name}}{(none)}
1108 \lineiii{BuildRequires}{\option{build\_requires}}{(none)}
1109 \lineiii{Icon}{\option{icon}}{(none)}
1110\end{tableiii}
1111Obviously, supplying even a few of these options on the command-line
1112would be tedious and error-prone, so it's usually best to put them in
1113the setup configuration file, \file{setup.cfg}---see
1114section~\ref{setup-config}. If you distribute or package many Python
1115module distributions, you might want to put options that apply to all of
1116them in your personal Distutils configuration file
1117(\file{\textasciitilde/.pydistutils.cfg}).
1118
1119There are three steps to building a binary RPM package, all of which are
1120handled automatically by the Distutils:
1121\begin{enumerate}
1122\item create a \file{.spec} file, which describes the package (analogous
1123 to the Distutils setup script; in fact, much of the information in the
1124 setup script winds up in the \file{.spec} file)
1125\item create the source RPM
1126\item create the ``binary'' RPM (which may or may not contain binary
1127 code, depending on whether your module distribution contains Python
1128 extensions)
1129\end{enumerate}
1130Normally, RPM bundles the last two steps together; when you use the
1131Distutils, all three steps are typically bundled together.
1132
1133If you wish, you can separate these three steps. You can use the
1134\longprogramopt{spec-only} option to make \command{bdist\_rpm} just
1135create the \file{.spec} file and exit; in this case, the \file{.spec}
1136file will be written to the ``distribution directory''---normally
1137\file{dist/}, but customizable with the \longprogramopt{dist-dir}
1138option. (Normally, the \file{.spec} file winds up deep in the ``build
1139tree,'' in a temporary directory created by \command{bdist\_rpm}.)
1140
1141\XXX{this isn't implemented yet---is it needed?!}
1142You can also specify a custom \file{.spec} file with the
Thomas Heller5f52f722001-02-19 17:48:03 +00001143\longprogramopt{spec-file} option; used in conjunction with
Greg Wardb6528972000-09-07 02:40:37 +00001144\longprogramopt{spec-only}, this gives you an opportunity to customize
1145the \file{.spec} file manually:
1146\begin{verbatim}
1147> python setup.py bdist_rpm --spec-only
1148# ...edit dist/FooBar-1.0.spec
1149> python setup.py bdist_rpm --spec-file=dist/FooBar-1.0.spec
1150\end{verbatim}
1151(Although a better way to do this is probably to override the standard
1152\command{bdist\_rpm} command with one that writes whatever else you want
1153to the \file{.spec} file; see section~\ref{extending} for information on
1154extending the Distutils.)
1155
1156
1157\subsection{Creating Windows installers}
1158\label{creating-wininst}
1159
Thomas Heller5f52f722001-02-19 17:48:03 +00001160Executable Windows installers are the natural format for binary
1161distributions on Windows. They display a nice GUI interface, display
1162some information of the module distribution to be installed, taken
1163from the meta-dada in the setup script, let the user select a few
1164(currently maybe too few) options, and start or cancel the installation.
Greg Wardb6528972000-09-07 02:40:37 +00001165
Thomas Heller5f52f722001-02-19 17:48:03 +00001166Since the meta-data is taken from the setup script, creating
1167Windows installers is usually as easy as running:
1168\begin{verbatim}
1169python setup.py bdist_wininst
1170\end{verbatim}
1171or the \command{bdist} command with the \longprogramopt{format} option:
1172\begin{verbatim}
1173python setup.py bdist --formats=wininst
1174\end{verbatim}
1175
1176If you have a pure module distribution (only containing pure
1177Python modules and packages), the resulting installer will be
1178version independent and have a name like \file{Foo-1.0.win32.exe}.
1179These installers can even be created on \UNIX{} or MacOS platforms.
1180
1181If you have a non-pure distribution, the extensions can only be
1182created on a Windows platform, and will be Python version dependend.
1183The installer filename will reflect this and now has the form
1184\file{Foo-1.0.win32-py2.0.exe}. You have to create a separate installer
1185for every Python version you want to support.
1186
1187The installer will try to compile pure modules into bytecode after
1188installation on the target system in normal and optimizing mode.
1189If you don't want this to happen for some reason, you can run
1190the bdist_wininst command with the \longprogramopt{no-target-compile} and/or
1191the \longprogramopt{no-target-optimize} option.
Greg Wardb6528972000-09-07 02:40:37 +00001192
Greg Ward16aafcd2000-04-09 04:06:44 +00001193\section{Examples}
Greg Warde78298a2000-04-28 17:12:24 +00001194\label{examples}
Greg Ward16aafcd2000-04-09 04:06:44 +00001195
1196
1197\subsection{Pure Python distribution (by module)}
Greg Warde78298a2000-04-28 17:12:24 +00001198\label{pure-mod}
Greg Ward16aafcd2000-04-09 04:06:44 +00001199
1200
1201\subsection{Pure Python distribution (by package)}
Greg Warde78298a2000-04-28 17:12:24 +00001202\label{pure-pkg}
Greg Ward16aafcd2000-04-09 04:06:44 +00001203
1204
1205\subsection{Single extension module}
Greg Warde78298a2000-04-28 17:12:24 +00001206\label{single-ext}
Greg Ward16aafcd2000-04-09 04:06:44 +00001207
1208
1209\subsection{Multiple extension modules}
Greg Warde78298a2000-04-28 17:12:24 +00001210\label{multiple-ext}
Greg Ward16aafcd2000-04-09 04:06:44 +00001211
1212
1213\subsection{Putting it all together}
1214
1215
Greg Ward4a9e7222000-04-25 02:57:36 +00001216
1217\section{Extending the Distutils}
Greg Warde78298a2000-04-28 17:12:24 +00001218\label{extending}
Greg Ward4a9e7222000-04-25 02:57:36 +00001219
1220
1221\subsection{Extending existing commands}
Greg Warde78298a2000-04-28 17:12:24 +00001222\label{extend-existing}
Greg Ward4a9e7222000-04-25 02:57:36 +00001223
1224
1225\subsection{Writing new commands}
Greg Warde78298a2000-04-28 17:12:24 +00001226\label{new-commands}
Greg Ward4a9e7222000-04-25 02:57:36 +00001227
Thomas Heller5f52f722001-02-19 17:48:03 +00001228\XXX{Would an uninstall command be a good example here?}
1229
Greg Ward4a9e7222000-04-25 02:57:36 +00001230
1231
Greg Ward16aafcd2000-04-09 04:06:44 +00001232\section{Reference}
Greg Ward47f99a62000-09-04 20:07:15 +00001233\label{reference}
Greg Ward16aafcd2000-04-09 04:06:44 +00001234
1235
Greg Wardfacb8db2000-04-09 04:32:40 +00001236\subsection{Building modules: the \protect\command{build} command family}
Greg Warde78298a2000-04-28 17:12:24 +00001237\label{build-cmds}
Greg Ward16aafcd2000-04-09 04:06:44 +00001238
Greg Wardfacb8db2000-04-09 04:32:40 +00001239\subsubsection{\protect\command{build}}
Greg Warde78298a2000-04-28 17:12:24 +00001240\label{build-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001241
Greg Wardfacb8db2000-04-09 04:32:40 +00001242\subsubsection{\protect\command{build\_py}}
Greg Warde78298a2000-04-28 17:12:24 +00001243\label{build-py-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001244
Greg Wardfacb8db2000-04-09 04:32:40 +00001245\subsubsection{\protect\command{build\_ext}}
Greg Warde78298a2000-04-28 17:12:24 +00001246\label{build-ext-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001247
Greg Wardfacb8db2000-04-09 04:32:40 +00001248\subsubsection{\protect\command{build\_clib}}
Greg Warde78298a2000-04-28 17:12:24 +00001249\label{build-clib-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001250
1251
Greg Wardfacb8db2000-04-09 04:32:40 +00001252\subsection{Installing modules: the \protect\command{install} command family}
Greg Warde78298a2000-04-28 17:12:24 +00001253\label{install-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001254
Gregory P. Smith147e5f32000-05-12 00:58:18 +00001255The install command ensures that the build commands have been run and then
1256runs the subcommands \command{install\_lib},
1257\command{install\_data} and
1258\command{install\_scripts}.
1259
1260\subsubsection{\protect\command{install\_lib}}
Greg Ward1365a302000-08-31 14:47:05 +00001261\label{install-lib-cmd}
Gregory P. Smith147e5f32000-05-12 00:58:18 +00001262
1263\subsubsection{\protect\command{install\_data}}
Greg Ward1365a302000-08-31 14:47:05 +00001264\label{install-data-cmd}
Gregory P. Smith147e5f32000-05-12 00:58:18 +00001265This command installs all data files provided with the distribution.
1266
1267\subsubsection{\protect\command{install\_scripts}}
Greg Ward1365a302000-08-31 14:47:05 +00001268\label{install-scripts-cmd}
Gregory P. Smith147e5f32000-05-12 00:58:18 +00001269This command installs all (Python) scripts in the distribution.
1270
Greg Ward16aafcd2000-04-09 04:06:44 +00001271
Greg Wardfacb8db2000-04-09 04:32:40 +00001272\subsection{Cleaning up: the \protect\command{clean} command}
Greg Warde78298a2000-04-28 17:12:24 +00001273\label{clean-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001274
1275
Fred Drakeeff9a872000-10-26 16:41:03 +00001276\subsection{Creating a source distribution: the
1277 \protect\command{sdist} command}
Greg Warde78298a2000-04-28 17:12:24 +00001278\label{sdist-cmd}
Greg Ward16aafcd2000-04-09 04:06:44 +00001279
1280
1281\XXX{fragment moved down from above: needs context!}
Greg Wardb6528972000-09-07 02:40:37 +00001282
Greg Ward16aafcd2000-04-09 04:06:44 +00001283The manifest template commands are:
1284\begin{tableii}{ll}{command}{Command}{Description}
Greg Ward87da1ea2000-04-21 04:35:25 +00001285 \lineii{include \var{pat1} \var{pat2} ... }
1286 {include all files matching any of the listed patterns}
1287 \lineii{exclude \var{pat1} \var{pat2} ... }
1288 {exclude all files matching any of the listed patterns}
1289 \lineii{recursive-include \var{dir} \var{pat1} \var{pat2} ... }
1290 {include all files under \var{dir} matching any of the listed patterns}
1291 \lineii{recursive-exclude \var{dir} \var{pat1} \var{pat2} ...}
1292 {exclude all files under \var{dir} matching any of the listed patterns}
1293 \lineii{global-include \var{pat1} \var{pat2} ...}
Greg Ward1bbe3292000-06-25 03:14:13 +00001294 {include all files anywhere in the source tree matching\\&
Greg Ward87da1ea2000-04-21 04:35:25 +00001295 any of the listed patterns}
1296 \lineii{global-exclude \var{pat1} \var{pat2} ...}
Greg Ward1bbe3292000-06-25 03:14:13 +00001297 {exclude all files anywhere in the source tree matching\\&
Greg Ward87da1ea2000-04-21 04:35:25 +00001298 any of the listed patterns}
Greg Ward16aafcd2000-04-09 04:06:44 +00001299 \lineii{prune \var{dir}}{exclude all files under \var{dir}}
1300 \lineii{graft \var{dir}}{include all files under \var{dir}}
1301\end{tableii}
Fred Drakeeff9a872000-10-26 16:41:03 +00001302The patterns here are \UNIX-style ``glob'' patterns: \code{*} matches any
Greg Ward16aafcd2000-04-09 04:06:44 +00001303sequence of regular filename characters, \code{?} matches any single
1304regular filename character, and \code{[\var{range}]} matches any of the
1305characters in \var{range} (e.g., \code{a-z}, \code{a-zA-Z},
Greg Wardfacb8db2000-04-09 04:32:40 +00001306\code{a-f0-9\_.}). The definition of ``regular filename character'' is
Fred Drakeeff9a872000-10-26 16:41:03 +00001307platform-specific: on \UNIX{} it is anything except slash; on Windows
1308anything except backslash or colon; on MacOS anything except colon.
Greg Wardb6528972000-09-07 02:40:37 +00001309
Fred Drakeeff9a872000-10-26 16:41:03 +00001310\XXX{Windows and MacOS support not there yet}
Greg Ward16aafcd2000-04-09 04:06:44 +00001311
1312
Greg Wardd5767a52000-04-19 22:48:09 +00001313\subsection{Creating a ``built'' distribution: the
1314 \protect\command{bdist} command family}
Greg Warde78298a2000-04-28 17:12:24 +00001315\label{bdist-cmds}
Greg Ward16aafcd2000-04-09 04:06:44 +00001316
1317
Greg Wardfacb8db2000-04-09 04:32:40 +00001318\subsubsection{\protect\command{blib}}
Greg Ward16aafcd2000-04-09 04:06:44 +00001319
Greg Wardfacb8db2000-04-09 04:32:40 +00001320\subsubsection{\protect\command{blib\_dumb}}
Greg Ward16aafcd2000-04-09 04:06:44 +00001321
Greg Wardfacb8db2000-04-09 04:32:40 +00001322\subsubsection{\protect\command{blib\_rpm}}
Greg Ward16aafcd2000-04-09 04:06:44 +00001323
Greg Wardfacb8db2000-04-09 04:32:40 +00001324\subsubsection{\protect\command{blib\_wise}}
Greg Ward16aafcd2000-04-09 04:06:44 +00001325
1326
1327
1328
1329
1330
1331
1332
Greg Wardabc52162000-02-26 00:52:48 +00001333\end{document}