Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 1 | \documentclass{howto} |
| 2 | \usepackage{ltxmarkup} |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 3 | \usepackage{times} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 4 | \usepackage{distutils} |
Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 5 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 6 | \title{Distributing Python Modules} |
Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 7 | |
Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 8 | \author{Greg Ward} |
| 9 | \authoraddress{E-mail: \email{gward@python.net}} |
| 10 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 11 | |
Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 12 | \begin{document} |
| 13 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 14 | \maketitle |
| 15 | \tableofcontents |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 16 | |
| 17 | \section{Introduction} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 18 | \label{intro} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 19 | |
| 20 | In the past, Python module developers have not had much infrastructure |
| 21 | support for distributing modules, nor have Python users had much support |
| 22 | for installing and maintaining third-party modules. With the |
| 23 | introduction of the Python Distribution Utilities (Distutils for short) |
| 24 | in Python 1.6, this situation should start to improve. |
| 25 | |
| 26 | This document only covers using the Distutils to distribute your Python |
| 27 | modules. Using the Distutils does not tie you to Python 1.6, though: |
| 28 | the Distutils work just fine with Python 1.5, and it is reasonable (and |
| 29 | expected to become commonplace) to expect users of Python 1.5 to |
| 30 | download and install the Distutils separately before they can install |
| 31 | your modules. Python 1.6 users, of course, won't have to add anything |
| 32 | to their Python installation in order to use the Distutils to install |
| 33 | third-party modules. |
| 34 | |
| 35 | This document concentrates on the role of developer/distributor: if |
| 36 | you're looking for information on installing Python modules, you should |
| 37 | refer to the ``Installing Python Modules'' manual. |
| 38 | |
| 39 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 40 | \section{Concepts \& Terminology} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 41 | \label{concepts} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 42 | |
| 43 | Using the Distutils is quite simple, both for module developers and for |
| 44 | users/administrators installing third-party modules. As a developer, |
| 45 | your responsibilites (apart from writing solid, well-documented and |
| 46 | well-tested code, of course!) are: |
| 47 | \begin{itemize} |
| 48 | \item write a setup script (\file{setup.py} by convention) |
| 49 | \item (optional) write a setup configuration file |
| 50 | \item create a source distribution |
| 51 | \item (optional) create one or more built (binary) distributions |
| 52 | \end{itemize} |
| 53 | Each of these tasks is covered in this document. |
| 54 | |
| 55 | Not all module developers have access to a multitude of platforms, so |
| 56 | it's not always feasible to expect them to create a multitude of built |
| 57 | distributions. It is hoped that a class of intermediaries, called |
| 58 | \emph{packagers}, will arise to take address this need. Packagers will |
| 59 | take source distributions released by module developers, build them on |
| 60 | one or more platforms, and release the resulting built distributions. |
| 61 | Thus, users on the most popular platforms will be able to install most |
| 62 | popular Python module distributions in the most natural way for their |
| 63 | platform, without having to run a single setup script or compile a line |
| 64 | of code. |
| 65 | |
| 66 | |
| 67 | \subsection{A simple example} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 68 | \label{simple-example} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 69 | |
| 70 | The setup script is usually quite simple, although since it's written in |
| 71 | Python, there are no arbitrary limits to what you can do. If all you |
| 72 | want to do is distribute a module called \module{foo}, contained in a |
| 73 | file \file{foo.py}, then you can get away with as little as this: |
| 74 | \begin{verbatim} |
| 75 | from distutils.core import setup |
| 76 | setup (name = "foo", |
| 77 | version = "1.0", |
| 78 | py_modules = ["foo"]) |
| 79 | \end{verbatim} |
| 80 | Some observations: |
| 81 | \begin{itemize} |
| 82 | \item all information that you supply to the Distutils is supplied as |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 83 | keyword arguments to the \function{setup()} function |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 84 | \item those keyword arguments fall into two categories: package |
| 85 | meta-data (name, version number) and information about what's in the |
| 86 | package (list of pure modules, in this case) |
| 87 | \item modules are specified by module name, not filename (the same will |
| 88 | hold true for packages and extensions) |
| 89 | \item it's recommended that you supply a little more meta-data, in |
| 90 | particular your name, email address and a URL for the project |
| 91 | \end{itemize} |
| 92 | |
| 93 | To create a source distribution for this module, you would run |
| 94 | \begin{verbatim} |
| 95 | python setup.py sdist |
| 96 | \end{verbatim} |
| 97 | which will create an archive file (e.g., tarball on Unix, zip file on |
| 98 | Windows) containing your setup script, \file{setup.py}, and your module, |
| 99 | \file{foo.py}. The archive file will be named \file{Foo-1.0.tar.gz} (or |
| 100 | \file{.zip}), and will unpack into a directory \file{Foo-1.0}. |
| 101 | |
| 102 | If an end-user wishes to install your \module{foo} module, all she has |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 103 | to do is download \file{Foo-1.0.tar.gz} (or \file{.zip}), unpack it, |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 104 | and---from the \file{Foo-1.0} directory---run |
| 105 | \begin{verbatim} |
| 106 | python setup.py install |
| 107 | \end{verbatim} |
| 108 | which will ultimately copy \file{foo.py} to the appropriate directory |
| 109 | for third-party modules in their Python installation. |
| 110 | |
| 111 | This simple example demonstrates some fundamental concepts of the |
| 112 | Distutils: first, both developers and installers have the same basic |
| 113 | user interface, i.e. the setup script. The difference is which |
| 114 | Distutils \emph{commands} they use: the \command{sdist} command is |
| 115 | almost exclusively for module developers, while \command{install} is |
| 116 | more often for installers (although most developers will want to install |
| 117 | their own code occasionally). |
| 118 | |
| 119 | \XXX{only partially implemented}% |
| 120 | If you want to make things really easy for your users, you can create |
| 121 | one or more built distributions for them. For instance, if you are |
| 122 | running on a Windows machine, and want to make things easy for other |
| 123 | Windows users, you can create an executable installer (the most |
| 124 | appropriate type of built distribution for this platform) with the |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 125 | \command{bdist\_wininst} command. For example: |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 126 | \begin{verbatim} |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 127 | python setup.py bdist_wininst |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 128 | \end{verbatim} |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 129 | will create an executable installer, \file{Foo-1\_0.exe}, in the current |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 130 | directory. |
| 131 | |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 132 | (Another way to create executable installers for Windows is with the |
| 133 | \command{bdist\_wise} command, which uses Wise---the commercial |
| 134 | installer-generator used to create Python's own installer---to create |
| 135 | the installer. Wise-based installers are more appropriate for large, |
| 136 | industrial-strength applications that need the full capabilities of a |
| 137 | ``real'' installer. \command{bdist\_wininst} creates a self-extracting |
| 138 | zip file with a minimal user interface, which is enough for small- to |
| 139 | medium-sized module collections. You'll need to have version XXX of |
| 140 | Wise installed on your system for the \command{bdist\_wise} to work; |
| 141 | it's available from \url{http://foo/bar/baz}.) |
| 142 | |
| 143 | Other \command{bdist} commands exist for other platforms: for example, |
| 144 | \command{bdist\_rpm} for RPM-based Linux systems, (\command{bdist\_deb}) |
| 145 | for Debian-based Linux systems, and so forth. See |
| 146 | section~\ref{bdist-cmds} for details on all the \command{bdist} |
| 147 | commands. |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 148 | |
| 149 | |
| 150 | \subsection{General Python terminology} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 151 | \label{python-terms} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 152 | |
| 153 | If you're reading this document, you probably have a good idea of what |
| 154 | modules, extensions, and so forth are. Nevertheless, just to be sure |
| 155 | that everyone is operating from a common starting point, we offer the |
| 156 | following glossary of common Python terms: |
| 157 | \begin{description} |
| 158 | \item[module] the basic unit of code reusability in Python: a block of |
| 159 | code imported by some other code. There are three types of modules |
| 160 | that concern us here: pure Python modules, extension modules, and |
| 161 | packages. |
| 162 | \item[pure Python module] a module written in Python and contained in a |
| 163 | single \file{.py} file (and possibly associated \file{.pyc} and/or |
| 164 | \file{.pyo} files). Sometimes referred to as a ``pure module.'' |
| 165 | \item[extension module] a module written in the low-level language of |
| 166 | the Python implemention: C/C++ for CPython, Java for JPython. |
| 167 | Typically contained in a single dynamically loadable pre-compiled |
| 168 | file, e.g. a shared object (\file{.so}) file for CPython extensions on |
| 169 | Unix, a DLL (given the \file{.pyd} extension) for CPython extensions |
| 170 | on Windows, or a Java class file for JPython extensions. |
| 171 | \item[package] a module that contains other modules; typically contained |
| 172 | in a directory in the filesystem and distinguished from other |
| 173 | directories by the presence of a file \file{\_\_init\_\_.py}. |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 174 | \item[root package] the ``package'' that modules not in a package live |
| 175 | in. The vast majority of the standard library is in the root package, |
| 176 | as are many small, standalone third-party modules that don't belong to |
| 177 | a larger module collection. (The root package isn't really a package, |
| 178 | since it doesn't have an \file{\_\_init\_\_.py} file. But we have to |
| 179 | call it something.) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 180 | \end{description} |
| 181 | |
| 182 | |
| 183 | \subsection{Distutils-specific terminology} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 184 | \label{distutils-term} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 185 | |
| 186 | The following terms apply more specifically to the domain of |
| 187 | distributing Python modules using the Distutils: |
| 188 | \begin{description} |
| 189 | \item[module distribution] a collection of Python modules distributed |
| 190 | together as a single downloadable resource and meant to be installed |
| 191 | \emph{en masse}. Examples of some well-known module distributions are |
| 192 | Numeric Python, PyXML, PIL (the Python Imaging Library), or |
| 193 | mxDateTime. (This would be called a \emph{package}, except that term |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 194 | is already taken in the Python context: a single module distribution |
| 195 | may contain zero, one, or many Python packages.) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 196 | \item[pure module distribution] a module distribution that contains only |
| 197 | pure Python modules and packages. Sometimes referred to as a ``pure |
| 198 | distribution.'' |
| 199 | \item[non-pure module distribution] a module distribution that contains |
| 200 | at least one extension module. Sometimes referred to as a ``non-pure |
| 201 | distribution.'' |
| 202 | \item[distribution root] the top-level directory of your source tree (or |
| 203 | source distribution); the directory where \file{setup.py} exists and |
| 204 | is run from |
| 205 | \end{description} |
| 206 | |
| 207 | |
| 208 | \section{Writing the Setup Script} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 209 | \label{setup-script} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 210 | |
| 211 | The setup script is the centre of all activity in building, |
| 212 | distributing, and installing modules using the Distutils. The main |
| 213 | purpose of the setup script is to describe your module distribution to |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 214 | the Distutils, so that the various commands that operate on your modules |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 215 | do the right thing. As we saw in section~\ref{simple-example} above, |
| 216 | the setup script consists mainly of a call to \function{setup()}, and |
| 217 | all information supplied to the Distutils is supplied as keyword |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 218 | arguments to \function{setup()}. |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 219 | |
| 220 | Here's a slightly more involved example, which we'll follow for the next |
| 221 | couple of sections: the Distutils' own setup script. (Keep in mind that |
| 222 | although the Distutils are included with Python 1.6, they also have an |
| 223 | independent existence so that Python 1.5 users can use them to install |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 224 | other module distributions. The Distutils' own setup script is used to |
| 225 | install the package into Python 1.5.) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 226 | |
| 227 | \begin{verbatim} |
| 228 | #!/usr/bin/env python |
| 229 | |
| 230 | from distutils.core import setup |
| 231 | |
| 232 | setup (name = "Distutils", |
| 233 | version = "1.0", |
| 234 | description = "Python Module Distribution Utilities", |
| 235 | author = "Greg Ward", |
| 236 | author_email = "gward@python.net", |
| 237 | url = "http://www.python.org/sigs/distutils-sig/", |
| 238 | |
| 239 | packages = ['distutils', 'distutils.command'], |
| 240 | ) |
| 241 | \end{verbatim} |
| 242 | There are only two differences between this and the trivial one-file |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 243 | distribution presented in section~\ref{simple-example}: more |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 244 | meta-data, and the specification of pure Python modules by package, |
| 245 | rather than by module. This is important since the Distutils consist of |
| 246 | a couple of dozen modules split into (so far) two packages; an explicit |
| 247 | list of every module would be tedious to generate and difficult to |
| 248 | maintain. |
| 249 | |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 250 | Note that any pathnames (files or directories) supplied in the setup |
| 251 | script should be written using the Unix convention, i.e. |
| 252 | slash-separated. The Distutils will take care of converting this |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 253 | platform-neutral representation into whatever is appropriate on your |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 254 | current platform before actually using the pathname. This makes your |
| 255 | setup script portable across operating systems, which of course is one |
| 256 | of the major goals of the Distutils. In this spirit, all pathnames in |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 257 | this document are slash-separated (Mac OS programmers should keep in |
| 258 | mind that the \emph{absence} of a leading slash indicates a relative |
| 259 | path, the opposite of the Mac OS convention with colons). |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 260 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 261 | |
| 262 | \subsection{Package directories} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 263 | \label{package-dirs} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 264 | |
| 265 | The \option{packages} option tells the Distutils to process (build, |
| 266 | distribute, install, etc.) all pure Python modules found in each package |
| 267 | mentioned in the \option{packages} list. In order to do this, of |
| 268 | course, there has to be a correspondence between package names and |
| 269 | directories in the filesystem. The default correspondence is the most |
Greg Ward | 1ecc251 | 2000-04-19 22:36:24 +0000 | [diff] [blame] | 270 | obvious one, i.e. package \module{distutils} is found in the directory |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 271 | \file{distutils} relative to the distribution root. Thus, when you say |
| 272 | \code{packages = ['foo']} in your setup script, you are promising that |
| 273 | the Distutils will find a file \file{foo/\_\_init\_\_.py} (which might |
| 274 | be spelled differently on your system, but you get the idea) relative to |
| 275 | the directory where your setup script lives. (If you break this |
| 276 | promise, the Distutils will issue a warning but process the broken |
| 277 | package anyways.) |
| 278 | |
| 279 | If you use a different convention to lay out your source directory, |
| 280 | that's no problem: you just have to supply the \option{package\_dir} |
| 281 | option to tell the Distutils about your convention. For example, say |
| 282 | you keep all Python source under \file{lib}, so that modules not in any |
Greg Ward | 1ecc251 | 2000-04-19 22:36:24 +0000 | [diff] [blame] | 283 | package are right in \file{lib}, modules in the \module{foo} package |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 284 | are in \file{lib/foo}, and so forth. Then you would put |
| 285 | \begin{verbatim} |
| 286 | package_dir = {'': 'lib'} |
| 287 | \end{verbatim} |
| 288 | in your setup script. (The keys to this dictionary are package names, |
| 289 | and an empty package name stands for the ``root package,'' i.e. no |
| 290 | package at all. The values are directory names relative to your |
| 291 | distribution root.) In this case, when you say |
| 292 | \code{packages = ['foo']}, you are promising that the file |
| 293 | \file{lib/foo/\_\_init\_\_.py} exists. |
| 294 | |
Greg Ward | 1ecc251 | 2000-04-19 22:36:24 +0000 | [diff] [blame] | 295 | Another possible convention is to put the \module{foo} package right in |
| 296 | \file{lib}, the \module{foo.bar} package in \file{lib/bar}, etc. This |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 297 | would be written in the setup script as |
| 298 | \begin{verbatim} |
| 299 | package_dir = {'foo': 'lib'} |
| 300 | \end{verbatim} |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 301 | A \code{\var{package}: \var{dir}} entry in the \option{package\_dir} |
| 302 | dictionary implicitly applies to all packages below \var{package}, so |
| 303 | the \module{foo.bar} case is automatically handled here. In this |
| 304 | example, having \code{packages = ['foo', 'foo.bar']} tells the Distutils |
| 305 | to look for \file{lib/\_\_init\_\_.py} and |
| 306 | \file{lib/bar/\_\_init\_\_.py}. (Keep in mind that although |
| 307 | \option{package\_dir} applies recursively, you must explicitly list all |
| 308 | packages in \option{packages}: the Distutils will \emph{not} recursively |
| 309 | scan your source tree looking for any directory with an |
| 310 | \file{\_\_init\_\_.py} file.) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 311 | |
| 312 | |
| 313 | \subsection{Listing individual modules} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 314 | \label{listing-modules} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 315 | |
| 316 | For a small module distribution, you might prefer to list all modules |
| 317 | rather than listing packages---especially the case of a single module |
| 318 | that goes in the ``root package'' (i.e., no package at all). This |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 319 | simplest case was shown in section~\ref{simple-example}; here is a |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 320 | slightly more involved example: |
| 321 | \begin{verbatim} |
| 322 | py_modules = ['mod1', 'pkg.mod2'] |
| 323 | \end{verbatim} |
| 324 | This describes two modules, one of them in the ``root'' package, the |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 325 | other in the \module{pkg} package. Again, the default package/directory |
| 326 | layout implies that these two modules can be found in \file{mod1.py} and |
| 327 | \file{pkg/mod2.py}, and that \file{pkg/\_\_init\_\_.py} exists as well. |
| 328 | And again, you can override the package/directory layout using the |
Greg Ward | 59d382e | 2000-05-26 01:04:47 +0000 | [diff] [blame^] | 329 | \option{package\_dir} option. |
| 330 | |
| 331 | |
| 332 | \subsection{Describing extension modules} |
| 333 | \label{sec:describing-extensions} |
| 334 | |
| 335 | \XXX{be sure to describe the whole \code{build\_info} dict, including |
| 336 | \code{extra\_compile\_args} and \code{extra\_link\_args}} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 337 | |
| 338 | |
| 339 | \section{Writing the Setup Configuration File} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 340 | \label{setup-config} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 341 | |
| 342 | \XXX{not implemented yet!} |
| 343 | |
| 344 | Often, it's not possible to write down everything needed to build a |
| 345 | distribution \emph{a priori}. You need to get some information from the |
| 346 | user, or from the user's system, in order to proceed. For example, you |
| 347 | might include an optional extension module that provides an interface to |
| 348 | a particular C library. If that library is installed on the user's |
| 349 | system, then you can build your optional extension---but you need to |
| 350 | know where to find the header and library file. If it's not installed, |
| 351 | you need to know this so you can omit your optional extension. |
| 352 | |
| 353 | The preferred way to do this, of course, would be for you to tell the |
| 354 | Distutils which optional features (C libraries, system calls, external |
| 355 | utilities, etc.) you're looking for, and it would inspect the user's |
| 356 | system and try to find them. This functionality may appear in a future |
| 357 | version of the Distutils, but it isn't there now. So, for the time |
| 358 | being, we rely on the user building and installing your software to |
| 359 | provide the necessary information. The vehicle for doing so is the |
| 360 | setup configuration file, \file{setup.cfg}. |
| 361 | |
| 362 | \XXX{need more here!} |
| 363 | |
| 364 | |
| 365 | \section{Creating a Source Distribution} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 366 | \label{source-dist} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 367 | |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 368 | As shown in section~\ref{simple-example}, you use the |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 369 | \command{sdist} command to create a source distribution. In the |
| 370 | simplest case, |
| 371 | \begin{verbatim} |
| 372 | python setup.py sdist |
| 373 | \end{verbatim} |
| 374 | (assuming you haven't specified any \command{sdist} options in the setup |
| 375 | script or config file), \command{sdist} creates the the archive of the |
| 376 | default format for the current platform. The default formats are: |
| 377 | \begin{tableii}{ll}{textrm}% |
| 378 | {Platform}{Default archive format for source distributions} |
| 379 | \lineii{Unix}{gzipped tar file (\file{.tar.gz})} |
| 380 | \lineii{Windows}{zip file} |
| 381 | \end{tableii} |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 382 | You can specify as many formats as you like using the |
| 383 | \longprogramopt{formats} option, for example: |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 384 | \begin{verbatim} |
| 385 | python setup.py sdist --formats=gztar,zip |
| 386 | \end{verbatim} |
| 387 | to create a gzipped tarball and a zip file. The available formats are: |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 388 | \begin{tableiii}{l|l|c}{code}% |
| 389 | {Format}{Description}{Notes} |
| 390 | \lineiii{zip}{zip file (\file{.zip})}{(1)} |
| 391 | \lineiii{gztar}{gzipped tar file (\file{.tar.gz})}{(2)} |
| 392 | \lineiii{ztar}{compressed tar file (\file{.tar.Z})}{} |
| 393 | \lineiii{tar}{tar file (\file{.tar})}{} |
| 394 | \end{tableiii} |
| 395 | |
| 396 | \noindent Notes: |
| 397 | \begin{description} |
| 398 | \item[(1)] default on Windows |
| 399 | \item[(2)] default on Unix |
| 400 | \end{description} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 401 | |
| 402 | |
| 403 | \subsection{The manifest and manifest template} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 404 | \label{manifest} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 405 | |
| 406 | Without any additional information, the \command{sdist} command puts a |
| 407 | minimal set of files into the source distribution: |
| 408 | \begin{itemize} |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 409 | \item all Python source files implied by the \option{py\_modules} and |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 410 | \option{packages} options |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 411 | \item all C source files mentioned in the \option{ext\_modules} or |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 412 | \option{libraries} options (\XXX{getting C library sources currently |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 413 | broken -- no get\_source\_files() method in build\_clib.py!}) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 414 | \item anything that looks like a test script: \file{test/test*.py} |
| 415 | (currently, the Distutils don't do anything with test scripts except |
| 416 | include them in source distributions, but in the future there will be |
| 417 | a standard for testing Python module distributions) |
| 418 | \item \file{README.txt} (or \file{README}) and \file{setup.py} |
| 419 | \end{itemize} |
| 420 | Sometimes this is enough, but usually you will want to specify |
| 421 | additional files to distribute. The typical way to do this is to write |
| 422 | a \emph{manifest template}, called \file{MANIFEST.in} by default. The |
| 423 | \command{sdist} command processes this template and generates a manifest |
| 424 | file, \file{MANIFEST}. (If you prefer, you can skip the manifest |
| 425 | template and generate the manifest yourself: it just lists one file per |
| 426 | line.) |
| 427 | |
| 428 | The manifest template has one command per line, where each command |
| 429 | specifies a set of files to include or exclude from the source |
| 430 | distribution. For an example, again we turn to the Distutils' own |
| 431 | manifest template: |
| 432 | \begin{verbatim} |
| 433 | include *.txt |
Greg Ward | 87da1ea | 2000-04-21 04:35:25 +0000 | [diff] [blame] | 434 | recursive-include examples *.txt *.py |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 435 | prune examples/sample?/build |
| 436 | \end{verbatim} |
| 437 | The meanings should be fairly clear: include all files in the |
| 438 | distribution root matching \code{*.txt}, all files anywhere under the |
| 439 | \file{examples} directory matching \code{*.txt} or \code{*.py}, and |
| 440 | exclude all directories matching \code{examples/sample?/build}. There |
| 441 | are several other commands available in the manifest template |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 442 | mini-language; see section~\ref{sdist-cmd}. |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 443 | |
| 444 | The order of commands in the manifest template very much matters: |
| 445 | initially, we have the list of default files as described above, and |
| 446 | each command in the template adds to or removes from that list of files. |
| 447 | When we have fully processed the manifest template, we have our complete |
| 448 | list of files. This list is written to the manifest for future |
| 449 | reference, and then used to build the source distribution archive(s). |
| 450 | |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 451 | Following the Distutils' own manifest template, let's trace how the |
| 452 | \command{sdist} command will build the list of files to include in the |
| 453 | Distutils source distribution: |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 454 | \begin{enumerate} |
| 455 | \item include all Python source files in the \file{distutils} and |
| 456 | \file{distutils/command} subdirectories (because packages |
| 457 | corresponding to those two directories were mentioned in the |
| 458 | \option{packages} option in the setup script) |
| 459 | \item include \file{test/test*.py} (always included) |
| 460 | \item include \file{README.txt} and \file{setup.py} (always included) |
| 461 | \item include \file{*.txt} in the distribution root (this will find |
| 462 | \file{README.txt} a second time, but such redundancies are weeded out |
| 463 | later) |
| 464 | \item in the sub-tree under \file{examples}, include anything matching |
| 465 | \file{*.txt} |
| 466 | \item in the sub-tree under \file{examples}, include anything matching |
| 467 | \file{*.py} |
| 468 | \item remove all files in the sub-trees starting at directories matching |
| 469 | \file{examples/sample?/build}---this may exclude files included by the |
| 470 | previous two steps, so it's important that the \code{prune} command in |
| 471 | the manifest template comes after the two \code{recursive-include} |
| 472 | commands |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 473 | \end{enumerate} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 474 | |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 475 | Just like in the setup script, file and directory names in the manifest |
| 476 | template should always be slash-separated; the Distutils will take care |
| 477 | of converting them to the standard representation on your platform. |
| 478 | That way, the manifest template is portable across operating systems. |
| 479 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 480 | |
| 481 | \subsection{Manifest-related options} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 482 | \label{manifest-options} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 483 | |
| 484 | The normal course of operations for the \command{sdist} command is as |
| 485 | follows: |
| 486 | \begin{itemize} |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 487 | \item if the manifest file, \file{MANIFEST} doesn't exist, read |
| 488 | \file{MANIFEST.in} and create the manifest |
| 489 | \item if \file{MANIFEST.in} is more recent than \file{MANIFEST}, |
| 490 | recreate \file{MANIFEST} by reading \file{MANIFEST.in} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 491 | \item use the list of files now in \file{MANIFEST} (either just |
| 492 | generated or read in) to create the source distribution archive(s) |
| 493 | \end{itemize} |
| 494 | There are a couple of options that modify this behaviour. |
| 495 | |
| 496 | First, you might want to force the manifest to be regenerated---for |
| 497 | example, if you have added or removed files or directories that match an |
| 498 | existing pattern in the manifest template, you should regenerate the |
| 499 | manifest: |
| 500 | \begin{verbatim} |
| 501 | python setup.py sdist --force-manifest |
| 502 | \end{verbatim} |
| 503 | \XXX{this is stupid, but is there a better way to do it without |
| 504 | reprocessing MANIFEST.in every single bloody time?} |
| 505 | |
| 506 | Or, you might just want to (re)generate the manifest, but not create a |
| 507 | source distribution: |
| 508 | \begin{verbatim} |
| 509 | python setup.py sdist --manifest-only |
| 510 | \end{verbatim} |
Greg Ward | a021aca | 2000-04-19 22:34:11 +0000 | [diff] [blame] | 511 | (\longprogramopt{manifest-only} implies \longprogramopt{force-manifest}.) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 512 | |
| 513 | If you don't want to use the default file set, you can supply the |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 514 | \longprogramopt{no-defaults} option. If you use |
| 515 | \longprogramopt{no-defaults} and don't supply a manifest template (or |
| 516 | it's empty, or nothing matches the patterns in it), then your source |
| 517 | distribution will be empty. |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 518 | |
| 519 | |
| 520 | \section{Creating Built Distributions} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 521 | \label{built-dist} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 522 | |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 523 | A ``built distribution'' is what you're probably used to thinking of |
| 524 | either as a ``binary package'' or an ``installer'' (depending on your |
| 525 | background). It's not necessarily binary, though, because it might |
| 526 | contain only Python source code and/or byte-code; and we don't call it a |
| 527 | package, because that word is already spoken for in Python. (And |
| 528 | ``installer'' is a term specific to the Windows world. \XXX{do Mac |
| 529 | people use it?}) |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 530 | |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 531 | A built distribution is how you make life as easy as possible for |
| 532 | installers of your module distribution: for users of RPM-based Linux |
| 533 | systems, it's a binary RPM; for Windows users, it's an executable |
| 534 | installer; for Debian-based Linux users, it's a Debian package; and so |
| 535 | forth. Obviously, no one person will be able to create built |
| 536 | distributions for every platform under the sun, so the Distutils is |
| 537 | designed to enable module developers to concentrate on their |
| 538 | specialty---writing code and creating source distributions---while an |
| 539 | intermediary species of \emph{packager} springs up to turn source |
| 540 | distributions into build distributions for as many platforms as there |
| 541 | are packagers. |
| 542 | |
| 543 | Of course, the module developer could be his own packager; or the |
| 544 | packager could be a volunteer ``out there'' somewhere who has access to |
| 545 | a platform which the original developer does not; or it could be |
| 546 | software periodically grabbing new source distributions and turning them |
| 547 | into built distributions for as many platforms as the software has |
| 548 | access to. Regardless of the nature of the beast, a packager uses the |
| 549 | setup script and the \command{bdist} command family to generate built |
| 550 | distributions. |
| 551 | |
| 552 | As a simple example, if I run the following command in the Distutils |
| 553 | source tree: |
| 554 | \begin{verbatim} |
| 555 | python setup.py bdist |
| 556 | \end{verbatim} |
| 557 | then the Distutils builds my module distribution (the Distutils itself |
| 558 | in this case), does a ``fake'' installation (also in the \file{build} |
| 559 | directory), and creates the default type of built distribution for my |
| 560 | platform. In Distutils 0.8, only two types of built distribution are |
| 561 | supported: \code{gztar} (default on non-Linux Unix) and \code{zip} |
| 562 | (default on Windows). Thus, the above command on a Unix system creates |
| 563 | \file{Distutils-0.8.built-posix.tar.gz}; unpacking this tarball from |
| 564 | Python's \filevar{prefix} directory installs the Distutils just as |
| 565 | though you had downloaded the source distribution and run \code{python |
| 566 | setup.py install}. Obviously, for pure Python distributions, this |
| 567 | isn't a huge win---but for non-pure distributions, which include |
| 568 | extensions that would need to be compiled, it can mean the difference |
| 569 | between someone being able to use your extensions or not. |
| 570 | |
| 571 | \XXX{filenames are inaccurate here!} |
| 572 | |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 573 | The \command{bdist} command has a \longprogramopt{format} option, |
| 574 | similar to the \command{sdist} command, that you can use to select which |
| 575 | formats to generate: for example, |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 576 | \begin{verbatim} |
| 577 | python setup.py bdist --format=zip |
| 578 | \end{verbatim} |
| 579 | would, when run on a Unix system, create |
| 580 | \file{Distutils-0.8.built-posix.tar.gz}---again, this archive would be |
| 581 | unpacked from Python's \filevar{prefix} directory to install the |
| 582 | Distutils. |
| 583 | |
| 584 | The available formats for built distributions are: |
| 585 | \begin{tableiii}{l|l|c}{code}% |
| 586 | {Format}{Description}{Notes} |
| 587 | \lineiii{zip}{zip file (\file{.zip})}{(1)} |
| 588 | \lineiii{gztar}{gzipped tar file (\file{.tar.gz})}{(2)} |
| 589 | \lineiii{ztar}{compressed tar file (\file{.tar.Z})}{} |
| 590 | \lineiii{tar}{tar file (\file{.tar})}{} |
| 591 | \lineiii{rpm}{RPM}{(3)} |
| 592 | \lineiii{srpm}{source RPM}{} |
| 593 | \lineiii{wise}{Wise installer for Windows}{} |
| 594 | \end{tableiii} |
| 595 | |
| 596 | \noindent Notes: |
| 597 | \begin{description} |
| 598 | \item[(1)] default on Windows |
| 599 | \item[(2)] default on Unix |
| 600 | \item[(3)] not implemented yet; will be default on RPM-based Linux |
| 601 | systems |
| 602 | \item[(5)] not implemented yet; will be default on Windows |
| 603 | \end{description} |
| 604 | |
| 605 | You don't have to use the \command{bdist} command with the |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 606 | \longprogramopt{formats} option; you can also use the command that |
| 607 | directly implements the format you're interested in. Many of these |
Greg Ward | 46b98e3 | 2000-04-14 01:53:36 +0000 | [diff] [blame] | 608 | \command{bdist} ``sub-commands'' actually generate several similar |
| 609 | formats; for instance, the \command{bdist\_dumb} command generates all |
| 610 | the ``dumb'' archive formats (\code{tar}, \code{ztar}, \code{gztar}, and |
| 611 | \code{zip}), and \command{bdist\_rpm} generates both binary and source |
| 612 | RPMs. The \command{bdist} sub-commands, and the formats generated by |
| 613 | each, are: |
| 614 | \begin{tableii}{l|l}{command}% |
| 615 | {Command}{Formats} |
| 616 | \lineii{bdist\_dumb}{tar, ztar, gztar, zip} |
| 617 | \lineii{bdist\_rpm}{rpm, srpm} |
| 618 | \lineii{bdist\_wise}{wise} |
| 619 | \end{tableii} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 620 | |
| 621 | \section{Examples} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 622 | \label{examples} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 623 | |
| 624 | |
| 625 | \subsection{Pure Python distribution (by module)} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 626 | \label{pure-mod} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 627 | |
| 628 | |
| 629 | \subsection{Pure Python distribution (by package)} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 630 | \label{pure-pkg} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 631 | |
| 632 | |
| 633 | \subsection{Single extension module} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 634 | \label{single-ext} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 635 | |
| 636 | |
| 637 | \subsection{Multiple extension modules} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 638 | \label{multiple-ext} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 639 | |
| 640 | |
| 641 | \subsection{Putting it all together} |
| 642 | |
| 643 | |
Greg Ward | 4a9e722 | 2000-04-25 02:57:36 +0000 | [diff] [blame] | 644 | |
| 645 | \section{Extending the Distutils} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 646 | \label{extending} |
Greg Ward | 4a9e722 | 2000-04-25 02:57:36 +0000 | [diff] [blame] | 647 | |
| 648 | |
| 649 | \subsection{Extending existing commands} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 650 | \label{extend-existing} |
Greg Ward | 4a9e722 | 2000-04-25 02:57:36 +0000 | [diff] [blame] | 651 | |
| 652 | |
| 653 | \subsection{Writing new commands} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 654 | \label{new-commands} |
Greg Ward | 4a9e722 | 2000-04-25 02:57:36 +0000 | [diff] [blame] | 655 | |
| 656 | |
| 657 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 658 | \section{Reference} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 659 | \label{ref} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 660 | |
| 661 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 662 | \subsection{Building modules: the \protect\command{build} command family} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 663 | \label{build-cmds} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 664 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 665 | \subsubsection{\protect\command{build}} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 666 | \label{build-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 667 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 668 | \subsubsection{\protect\command{build\_py}} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 669 | \label{build-py-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 670 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 671 | \subsubsection{\protect\command{build\_ext}} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 672 | \label{build-ext-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 673 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 674 | \subsubsection{\protect\command{build\_clib}} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 675 | \label{build-clib-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 676 | |
| 677 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 678 | \subsection{Installing modules: the \protect\command{install} command family} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 679 | \label{install-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 680 | |
Gregory P. Smith | 147e5f3 | 2000-05-12 00:58:18 +0000 | [diff] [blame] | 681 | The install command ensures that the build commands have been run and then |
| 682 | runs the subcommands \command{install\_lib}, |
| 683 | \command{install\_data} and |
| 684 | \command{install\_scripts}. |
| 685 | |
| 686 | \subsubsection{\protect\command{install\_lib}} |
| 687 | \label{sec:install-lib-cmd} |
| 688 | |
| 689 | \subsubsection{\protect\command{install\_data}} |
| 690 | \label{sec:install-data-cmd} |
| 691 | This command installs all data files provided with the distribution. |
| 692 | |
| 693 | \subsubsection{\protect\command{install\_scripts}} |
| 694 | \label{sec:install-scripts-cmd} |
| 695 | This command installs all (Python) scripts in the distribution. |
| 696 | |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 697 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 698 | \subsection{Cleaning up: the \protect\command{clean} command} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 699 | \label{clean-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 700 | |
| 701 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 702 | \subsection{Creating a source distribution: the \protect\command{sdist} command} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 703 | \label{sdist-cmd} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 704 | |
| 705 | |
| 706 | \XXX{fragment moved down from above: needs context!} |
| 707 | The manifest template commands are: |
| 708 | \begin{tableii}{ll}{command}{Command}{Description} |
Greg Ward | 87da1ea | 2000-04-21 04:35:25 +0000 | [diff] [blame] | 709 | \lineii{include \var{pat1} \var{pat2} ... } |
| 710 | {include all files matching any of the listed patterns} |
| 711 | \lineii{exclude \var{pat1} \var{pat2} ... } |
| 712 | {exclude all files matching any of the listed patterns} |
| 713 | \lineii{recursive-include \var{dir} \var{pat1} \var{pat2} ... } |
| 714 | {include all files under \var{dir} matching any of the listed patterns} |
| 715 | \lineii{recursive-exclude \var{dir} \var{pat1} \var{pat2} ...} |
| 716 | {exclude all files under \var{dir} matching any of the listed patterns} |
| 717 | \lineii{global-include \var{pat1} \var{pat2} ...} |
| 718 | {include all files anywhere in the source tree matching |
| 719 | any of the listed patterns} |
| 720 | \lineii{global-exclude \var{pat1} \var{pat2} ...} |
| 721 | {exclude all files anywhere in the source tree matching |
| 722 | any of the listed patterns} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 723 | \lineii{prune \var{dir}}{exclude all files under \var{dir}} |
| 724 | \lineii{graft \var{dir}}{include all files under \var{dir}} |
| 725 | \end{tableii} |
| 726 | The patterns here are Unix-style ``glob'' patterns: \code{*} matches any |
| 727 | sequence of regular filename characters, \code{?} matches any single |
| 728 | regular filename character, and \code{[\var{range}]} matches any of the |
| 729 | characters in \var{range} (e.g., \code{a-z}, \code{a-zA-Z}, |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 730 | \code{a-f0-9\_.}). The definition of ``regular filename character'' is |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 731 | platform-specific: on Unix it is anything except slash; on Windows |
| 732 | anything except backslash or colon; on Mac OS anything except colon. |
| 733 | \XXX{Windows and Mac OS support not there yet} |
| 734 | |
| 735 | |
Greg Ward | d5767a5 | 2000-04-19 22:48:09 +0000 | [diff] [blame] | 736 | \subsection{Creating a ``built'' distribution: the |
| 737 | \protect\command{bdist} command family} |
Greg Ward | e78298a | 2000-04-28 17:12:24 +0000 | [diff] [blame] | 738 | \label{bdist-cmds} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 739 | |
| 740 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 741 | \subsubsection{\protect\command{blib}} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 742 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 743 | \subsubsection{\protect\command{blib\_dumb}} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 744 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 745 | \subsubsection{\protect\command{blib\_rpm}} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 746 | |
Greg Ward | facb8db | 2000-04-09 04:32:40 +0000 | [diff] [blame] | 747 | \subsubsection{\protect\command{blib\_wise}} |
Greg Ward | 16aafcd | 2000-04-09 04:06:44 +0000 | [diff] [blame] | 748 | |
| 749 | |
| 750 | |
| 751 | |
| 752 | |
| 753 | |
| 754 | |
| 755 | |
Greg Ward | abc5216 | 2000-02-26 00:52:48 +0000 | [diff] [blame] | 756 | \end{document} |