blob: cafde20e548f6adb6c24d40ea1f37ca351d8a2d0 [file] [log] [blame]
Éric Araujo3a9f58f2011-06-01 20:42:49 +02001.. _packaging-setup-script:
2
3************************
4Writing the Setup Script
5************************
6
7The setup script is the center of all activity in building, distributing, and
8installing modules using Distutils. The main purpose of the setup script is
9to describe your module distribution to Distutils, so that the various
10commands that operate on your modules do the right thing. As we saw in section
11:ref:`packaging-simple-example`, the setup script consists mainly of a
Éric Araujo5da37be2011-06-01 20:44:40 +020012call to :func:`setup` where the most information is supplied as
Éric Araujo3a9f58f2011-06-01 20:42:49 +020013keyword arguments to :func:`setup`.
14
15Here's a slightly more involved example, which we'll follow for the next couple
16of sections: a setup script that could be used for Packaging itself::
17
18 #!/usr/bin/env python
19
20 from packaging.core import setup, find_packages
21
22 setup(name='Packaging',
23 version='1.0',
24 summary='Python Distribution Utilities',
25 keywords=['packaging', 'packaging'],
26 author=u'Tarek Ziadé',
27 author_email='tarek@ziade.org',
28 home_page='http://bitbucket.org/tarek/packaging/wiki/Home',
29 license='PSF',
30 packages=find_packages())
31
32
33There are only two differences between this and the trivial one-file
34distribution presented in section :ref:`packaging-simple-example`: more
35metadata and the specification of pure Python modules by package rather than
36by module. This is important since Ristutils consist of a couple of dozen
37modules split into (so far) two packages; an explicit list of every module
38would be tedious to generate and difficult to maintain. For more information
39on the additional metadata, see section :ref:`packaging-metadata`.
40
41Note that any pathnames (files or directories) supplied in the setup script
42should be written using the Unix convention, i.e. slash-separated. The
43Distutils will take care of converting this platform-neutral representation into
44whatever is appropriate on your current platform before actually using the
45pathname. This makes your setup script portable across operating systems, which
46of course is one of the major goals of the Distutils. In this spirit, all
47pathnames in this document are slash-separated.
48
49This, of course, only applies to pathnames given to Distutils functions. If
50you, for example, use standard Python functions such as :func:`glob.glob` or
51:func:`os.listdir` to specify files, you should be careful to write portable
52code instead of hardcoding path separators::
53
54 glob.glob(os.path.join('mydir', 'subdir', '*.html'))
55 os.listdir(os.path.join('mydir', 'subdir'))
56
57
58.. _packaging-listing-packages:
59
60Listing whole packages
61======================
62
63The :option:`packages` option tells the Distutils to process (build, distribute,
64install, etc.) all pure Python modules found in each package mentioned in the
65:option:`packages` list. In order to do this, of course, there has to be a
66correspondence between package names and directories in the filesystem. The
67default correspondence is the most obvious one, i.e. package :mod:`packaging` is
68found in the directory :file:`packaging` relative to the distribution root.
69Thus, when you say ``packages = ['foo']`` in your setup script, you are
70promising that the Distutils will find a file :file:`foo/__init__.py` (which
71might be spelled differently on your system, but you get the idea) relative to
72the directory where your setup script lives. If you break this promise, the
R David Murray677b6532011-07-18 12:39:18 -040073Distutils will issue a warning but still process the broken package anyway.
Éric Araujo3a9f58f2011-06-01 20:42:49 +020074
75If you use a different convention to lay out your source directory, that's no
76problem: you just have to supply the :option:`package_dir` option to tell the
77Distutils about your convention. For example, say you keep all Python source
78under :file:`lib`, so that modules in the "root package" (i.e., not in any
79package at all) are in :file:`lib`, modules in the :mod:`foo` package are in
80:file:`lib/foo`, and so forth. Then you would put ::
81
82 package_dir = {'': 'lib'}
83
84in your setup script. The keys to this dictionary are package names, and an
85empty package name stands for the root package. The values are directory names
86relative to your distribution root. In this case, when you say ``packages =
87['foo']``, you are promising that the file :file:`lib/foo/__init__.py` exists.
88
89Another possible convention is to put the :mod:`foo` package right in
90:file:`lib`, the :mod:`foo.bar` package in :file:`lib/bar`, etc. This would be
91written in the setup script as ::
92
93 package_dir = {'foo': 'lib'}
94
95A ``package: dir`` entry in the :option:`package_dir` dictionary implicitly
96applies to all packages below *package*, so the :mod:`foo.bar` case is
97automatically handled here. In this example, having ``packages = ['foo',
98'foo.bar']`` tells the Distutils to look for :file:`lib/__init__.py` and
99:file:`lib/bar/__init__.py`. (Keep in mind that although :option:`package_dir`
100applies recursively, you must explicitly list all packages in
101:option:`packages`: the Distutils will *not* recursively scan your source tree
102looking for any directory with an :file:`__init__.py` file.)
103
104
105.. _packaging-listing-modules:
106
107Listing individual modules
108==========================
109
110For a small module distribution, you might prefer to list all modules rather
111than listing packages---especially the case of a single module that goes in the
112"root package" (i.e., no package at all). This simplest case was shown in
113section :ref:`packaging-simple-example`; here is a slightly more involved
114example::
115
116 py_modules = ['mod1', 'pkg.mod2']
117
118This describes two modules, one of them in the "root" package, the other in the
119:mod:`pkg` package. Again, the default package/directory layout implies that
120these two modules can be found in :file:`mod1.py` and :file:`pkg/mod2.py`, and
121that :file:`pkg/__init__.py` exists as well. And again, you can override the
122package/directory correspondence using the :option:`package_dir` option.
123
124
125.. _packaging-describing-extensions:
126
127Describing extension modules
128============================
129
130Just as writing Python extension modules is a bit more complicated than writing
131pure Python modules, describing them to the Distutils is a bit more complicated.
132Unlike pure modules, it's not enough just to list modules or packages and expect
133the Distutils to go out and find the right files; you have to specify the
134extension name, source file(s), and any compile/link requirements (include
135directories, libraries to link with, etc.).
136
137.. XXX read over this section
138
139All of this is done through another keyword argument to :func:`setup`, the
140:option:`ext_modules` option. :option:`ext_modules` is just a list of
141:class:`Extension` instances, each of which describes a single extension module.
142Suppose your distribution includes a single extension, called :mod:`foo` and
143implemented by :file:`foo.c`. If no additional instructions to the
144compiler/linker are needed, describing this extension is quite simple::
145
146 Extension('foo', ['foo.c'])
147
148The :class:`Extension` class can be imported from :mod:`packaging.core` along
149with :func:`setup`. Thus, the setup script for a module distribution that
150contains only this one extension and nothing else might be::
151
152 from packaging.core import setup, Extension
153 setup(name='foo',
154 version='1.0',
155 ext_modules=[Extension('foo', ['foo.c'])])
156
157The :class:`Extension` class (actually, the underlying extension-building
158machinery implemented by the :command:`build_ext` command) supports a great deal
159of flexibility in describing Python extensions, which is explained in the
160following sections.
161
162
163Extension names and packages
164----------------------------
165
166The first argument to the :class:`Extension` constructor is always the name of
167the extension, including any package names. For example, ::
168
169 Extension('foo', ['src/foo1.c', 'src/foo2.c'])
170
171describes an extension that lives in the root package, while ::
172
173 Extension('pkg.foo', ['src/foo1.c', 'src/foo2.c'])
174
175describes the same extension in the :mod:`pkg` package. The source files and
176resulting object code are identical in both cases; the only difference is where
177in the filesystem (and therefore where in Python's namespace hierarchy) the
178resulting extension lives.
179
Éric Araujo4d4b19e2011-10-21 07:34:00 +0200180If your distribution contains only one or more extension modules in a package,
181you need to create a :file:`{package}/__init__.py` file anyway, otherwise Python
182won't be able to import anything.
183
Éric Araujo3a9f58f2011-06-01 20:42:49 +0200184If you have a number of extensions all in the same package (or all under the
185same base package), use the :option:`ext_package` keyword argument to
186:func:`setup`. For example, ::
187
188 setup(...,
189 ext_package='pkg',
190 ext_modules=[Extension('foo', ['foo.c']),
191 Extension('subpkg.bar', ['bar.c'])])
192
193will compile :file:`foo.c` to the extension :mod:`pkg.foo`, and :file:`bar.c` to
194:mod:`pkg.subpkg.bar`.
195
196
197Extension source files
198----------------------
199
200The second argument to the :class:`Extension` constructor is a list of source
201files. Since the Distutils currently only support C, C++, and Objective-C
202extensions, these are normally C/C++/Objective-C source files. (Be sure to use
203appropriate extensions to distinguish C++\ source files: :file:`.cc` and
204:file:`.cpp` seem to be recognized by both Unix and Windows compilers.)
205
206However, you can also include SWIG interface (:file:`.i`) files in the list; the
207:command:`build_ext` command knows how to deal with SWIG extensions: it will run
208SWIG on the interface file and compile the resulting C/C++ file into your
209extension.
210
211.. XXX SWIG support is rough around the edges and largely untested!
212
213This warning notwithstanding, options to SWIG can be currently passed like
214this::
215
216 setup(...,
217 ext_modules=[Extension('_foo', ['foo.i'],
218 swig_opts=['-modern', '-I../include'])],
219 py_modules=['foo'])
220
221Or on the command line like this::
222
223 > python setup.py build_ext --swig-opts="-modern -I../include"
224
225On some platforms, you can include non-source files that are processed by the
226compiler and included in your extension. Currently, this just means Windows
227message text (:file:`.mc`) files and resource definition (:file:`.rc`) files for
228Visual C++. These will be compiled to binary resource (:file:`.res`) files and
229linked into the executable.
230
231
232Preprocessor options
233--------------------
234
235Three optional arguments to :class:`Extension` will help if you need to specify
236include directories to search or preprocessor macros to define/undefine:
237``include_dirs``, ``define_macros``, and ``undef_macros``.
238
239For example, if your extension requires header files in the :file:`include`
240directory under your distribution root, use the ``include_dirs`` option::
241
242 Extension('foo', ['foo.c'], include_dirs=['include'])
243
244You can specify absolute directories there; if you know that your extension will
245only be built on Unix systems with X11R6 installed to :file:`/usr`, you can get
246away with ::
247
248 Extension('foo', ['foo.c'], include_dirs=['/usr/include/X11'])
249
250You should avoid this sort of non-portable usage if you plan to distribute your
251code: it's probably better to write C code like ::
252
253 #include <X11/Xlib.h>
254
255If you need to include header files from some other Python extension, you can
256take advantage of the fact that header files are installed in a consistent way
257by the Distutils :command:`install_header` command. For example, the Numerical
258Python header files are installed (on a standard Unix installation) to
259:file:`/usr/local/include/python1.5/Numerical`. (The exact location will differ
260according to your platform and Python installation.) Since the Python include
261directory---\ :file:`/usr/local/include/python1.5` in this case---is always
262included in the search path when building Python extensions, the best approach
263is to write C code like ::
264
265 #include <Numerical/arrayobject.h>
266
267.. TODO check if it's d2.sysconfig or the new sysconfig module now
268
269If you must put the :file:`Numerical` include directory right into your header
270search path, though, you can find that directory using the Distutils
271:mod:`packaging.sysconfig` module::
272
273 from packaging.sysconfig import get_python_inc
274 incdir = os.path.join(get_python_inc(plat_specific=1), 'Numerical')
275 setup(...,
276 Extension(..., include_dirs=[incdir]))
277
278Even though this is quite portable---it will work on any Python installation,
279regardless of platform---it's probably easier to just write your C code in the
280sensible way.
281
282You can define and undefine preprocessor macros with the ``define_macros`` and
283``undef_macros`` options. ``define_macros`` takes a list of ``(name, value)``
284tuples, where ``name`` is the name of the macro to define (a string) and
285``value`` is its value: either a string or ``None``. (Defining a macro ``FOO``
286to ``None`` is the equivalent of a bare ``#define FOO`` in your C source: with
287most compilers, this sets ``FOO`` to the string ``1``.) ``undef_macros`` is
288just a list of macros to undefine.
289
290For example::
291
292 Extension(...,
293 define_macros=[('NDEBUG', '1'),
294 ('HAVE_STRFTIME', None)],
295 undef_macros=['HAVE_FOO', 'HAVE_BAR'])
296
297is the equivalent of having this at the top of every C source file::
298
299 #define NDEBUG 1
300 #define HAVE_STRFTIME
301 #undef HAVE_FOO
302 #undef HAVE_BAR
303
304
305Library options
306---------------
307
308You can also specify the libraries to link against when building your extension,
309and the directories to search for those libraries. The ``libraries`` option is
310a list of libraries to link against, ``library_dirs`` is a list of directories
311to search for libraries at link-time, and ``runtime_library_dirs`` is a list of
312directories to search for shared (dynamically loaded) libraries at run-time.
313
314For example, if you need to link against libraries known to be in the standard
315library search path on target systems ::
316
317 Extension(...,
318 libraries=['gdbm', 'readline'])
319
320If you need to link with libraries in a non-standard location, you'll have to
321include the location in ``library_dirs``::
322
323 Extension(...,
324 library_dirs=['/usr/X11R6/lib'],
325 libraries=['X11', 'Xt'])
326
327(Again, this sort of non-portable construct should be avoided if you intend to
328distribute your code.)
329
330.. XXX Should mention clib libraries here or somewhere else!
331
332
333Other options
334-------------
335
336There are still some other options which can be used to handle special cases.
337
338The :option:`optional` option is a boolean; if it is true,
339a build failure in the extension will not abort the build process, but
340instead simply not install the failing extension.
341
342The :option:`extra_objects` option is a list of object files to be passed to the
343linker. These files must not have extensions, as the default extension for the
344compiler is used.
345
346:option:`extra_compile_args` and :option:`extra_link_args` can be used to
347specify additional command-line options for the respective compiler and linker
348command lines.
349
350:option:`export_symbols` is only useful on Windows. It can contain a list of
351symbols (functions or variables) to be exported. This option is not needed when
352building compiled extensions: Distutils will automatically add ``initmodule``
353to the list of exported symbols.
354
355The :option:`depends` option is a list of files that the extension depends on
356(for example header files). The build command will call the compiler on the
357sources to rebuild extension if any on this files has been modified since the
358previous build.
359
360Relationships between Distributions and Packages
361================================================
362
363.. FIXME rewrite to update to PEP 345 (but without dist/release confusion)
364
365A distribution may relate to packages in three specific ways:
366
367#. It can require packages or modules.
368
369#. It can provide packages or modules.
370
371#. It can obsolete packages or modules.
372
373These relationships can be specified using keyword arguments to the
374:func:`packaging.core.setup` function.
375
376Dependencies on other Python modules and packages can be specified by supplying
377the *requires* keyword argument to :func:`setup`. The value must be a list of
378strings. Each string specifies a package that is required, and optionally what
379versions are sufficient.
380
381To specify that any version of a module or package is required, the string
382should consist entirely of the module or package name. Examples include
383``'mymodule'`` and ``'xml.parsers.expat'``.
384
385If specific versions are required, a sequence of qualifiers can be supplied in
386parentheses. Each qualifier may consist of a comparison operator and a version
387number. The accepted comparison operators are::
388
389 < > ==
390 <= >= !=
391
392These can be combined by using multiple qualifiers separated by commas (and
393optional whitespace). In this case, all of the qualifiers must be matched; a
394logical AND is used to combine the evaluations.
395
396Let's look at a bunch of examples:
397
398+-------------------------+----------------------------------------------+
399| Requires Expression | Explanation |
400+=========================+==============================================+
401| ``==1.0`` | Only version ``1.0`` is compatible |
402+-------------------------+----------------------------------------------+
403| ``>1.0, !=1.5.1, <2.0`` | Any version after ``1.0`` and before ``2.0`` |
404| | is compatible, except ``1.5.1`` |
405+-------------------------+----------------------------------------------+
406
407Now that we can specify dependencies, we also need to be able to specify what we
408provide that other distributions can require. This is done using the *provides*
409keyword argument to :func:`setup`. The value for this keyword is a list of
410strings, each of which names a Python module or package, and optionally
411identifies the version. If the version is not specified, it is assumed to match
412that of the distribution.
413
414Some examples:
415
416+---------------------+----------------------------------------------+
417| Provides Expression | Explanation |
418+=====================+==============================================+
419| ``mypkg`` | Provide ``mypkg``, using the distribution |
420| | version |
421+---------------------+----------------------------------------------+
422| ``mypkg (1.1)`` | Provide ``mypkg`` version 1.1, regardless of |
423| | the distribution version |
424+---------------------+----------------------------------------------+
425
426A package can declare that it obsoletes other packages using the *obsoletes*
427keyword argument. The value for this is similar to that of the *requires*
428keyword: a list of strings giving module or package specifiers. Each specifier
429consists of a module or package name optionally followed by one or more version
430qualifiers. Version qualifiers are given in parentheses after the module or
431package name.
432
433The versions identified by the qualifiers are those that are obsoleted by the
434distribution being described. If no qualifiers are given, all versions of the
435named module or package are understood to be obsoleted.
436
437.. _packaging-installing-scripts:
438
439Installing Scripts
440==================
441
442So far we have been dealing with pure and non-pure Python modules, which are
443usually not run by themselves but imported by scripts.
444
445Scripts are files containing Python source code, intended to be started from the
446command line. Scripts don't require Distutils to do anything very complicated.
447The only clever feature is that if the first line of the script starts with
448``#!`` and contains the word "python", the Distutils will adjust the first line
449to refer to the current interpreter location. By default, it is replaced with
450the current interpreter location. The :option:`--executable` (or :option:`-e`)
451option will allow the interpreter path to be explicitly overridden.
452
453The :option:`scripts` option simply is a list of files to be handled in this
454way. From the PyXML setup script::
455
456 setup(...,
457 scripts=['scripts/xmlproc_parse', 'scripts/xmlproc_val'])
458
459All the scripts will also be added to the ``MANIFEST`` file if no template is
460provided. See :ref:`packaging-manifest`.
461
462.. _packaging-installing-package-data:
463
464Installing Package Data
465=======================
466
467Often, additional files need to be installed into a package. These files are
468often data that's closely related to the package's implementation, or text files
469containing documentation that might be of interest to programmers using the
470package. These files are called :dfn:`package data`.
471
472Package data can be added to packages using the ``package_data`` keyword
473argument to the :func:`setup` function. The value must be a mapping from
474package name to a list of relative path names that should be copied into the
475package. The paths are interpreted as relative to the directory containing the
476package (information from the ``package_dir`` mapping is used if appropriate);
477that is, the files are expected to be part of the package in the source
478directories. They may contain glob patterns as well.
479
480The path names may contain directory portions; any necessary directories will be
481created in the installation.
482
483For example, if a package should contain a subdirectory with several data files,
484the files can be arranged like this in the source tree::
485
486 setup.py
487 src/
488 mypkg/
489 __init__.py
490 module.py
491 data/
492 tables.dat
493 spoons.dat
494 forks.dat
495
496The corresponding call to :func:`setup` might be::
497
498 setup(...,
499 packages=['mypkg'],
500 package_dir={'mypkg': 'src/mypkg'},
501 package_data={'mypkg': ['data/*.dat']})
502
503
504All the files that match ``package_data`` will be added to the ``MANIFEST``
505file if no template is provided. See :ref:`packaging-manifest`.
506
507
508.. _packaging-additional-files:
509
510Installing Additional Files
511===========================
512
513The :option:`data_files` option can be used to specify additional files needed
514by the module distribution: configuration files, message catalogs, data files,
515anything which doesn't fit in the previous categories.
516
517:option:`data_files` specifies a sequence of (*directory*, *files*) pairs in the
518following way::
519
520 setup(...,
521 data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
522 ('config', ['cfg/data.cfg']),
523 ('/etc/init.d', ['init-script'])])
524
525Note that you can specify the directory names where the data files will be
526installed, but you cannot rename the data files themselves.
527
528Each (*directory*, *files*) pair in the sequence specifies the installation
529directory and the files to install there. If *directory* is a relative path, it
530is interpreted relative to the installation prefix (Python's ``sys.prefix`` for
531pure-Python packages, ``sys.exec_prefix`` for packages that contain extension
532modules). Each file name in *files* is interpreted relative to the
533:file:`setup.py` script at the top of the package source distribution. No
534directory information from *files* is used to determine the final location of
535the installed file; only the name of the file is used.
536
537You can specify the :option:`data_files` options as a simple sequence of files
538without specifying a target directory, but this is not recommended, and the
539:command:`install_dist` command will print a warning in this case. To install data
540files directly in the target directory, an empty string should be given as the
541directory.
542
543All the files that match ``data_files`` will be added to the ``MANIFEST`` file
544if no template is provided. See :ref:`packaging-manifest`.
545
546
547
548.. _packaging-metadata:
549
550Metadata reference
551==================
552
553The setup script may include additional metadata beyond the name and version.
554This table describes required and additional information:
555
556.. TODO synchronize with setupcfg; link to it (but don't remove it, it's a
557 useful summary)
558
559+----------------------+---------------------------+-----------------+--------+
560| Meta-Data | Description | Value | Notes |
561+======================+===========================+=================+========+
562| ``name`` | name of the project | short string | \(1) |
563+----------------------+---------------------------+-----------------+--------+
564| ``version`` | version of this release | short string | (1)(2) |
565+----------------------+---------------------------+-----------------+--------+
566| ``author`` | project author's name | short string | \(3) |
567+----------------------+---------------------------+-----------------+--------+
568| ``author_email`` | email address of the | email address | \(3) |
569| | project author | | |
570+----------------------+---------------------------+-----------------+--------+
571| ``maintainer`` | project maintainer's name | short string | \(3) |
572+----------------------+---------------------------+-----------------+--------+
573| ``maintainer_email`` | email address of the | email address | \(3) |
574| | project maintainer | | |
575+----------------------+---------------------------+-----------------+--------+
576| ``home_page`` | home page for the project | URL | \(1) |
577+----------------------+---------------------------+-----------------+--------+
578| ``summary`` | short description of the | short string | |
579| | project | | |
580+----------------------+---------------------------+-----------------+--------+
581| ``description`` | longer description of the | long string | \(5) |
582| | project | | |
583+----------------------+---------------------------+-----------------+--------+
584| ``download_url`` | location where the | URL | |
585| | project may be downloaded | | |
586+----------------------+---------------------------+-----------------+--------+
587| ``classifiers`` | a list of classifiers | list of strings | \(4) |
588+----------------------+---------------------------+-----------------+--------+
589| ``platforms`` | a list of platforms | list of strings | |
590+----------------------+---------------------------+-----------------+--------+
591| ``license`` | license for the release | short string | \(6) |
592+----------------------+---------------------------+-----------------+--------+
593
594Notes:
595
596(1)
597 These fields are required.
598
599(2)
600 It is recommended that versions take the form *major.minor[.patch[.sub]]*.
601
602(3)
603 Either the author or the maintainer must be identified.
604
605(4)
606 The list of classifiers is available from the `PyPI website
607 <http://pypi.python.org/pypi>`_. See also :mod:`packaging.create`.
608
609(5)
610 The ``description`` field is used by PyPI when you are registering a
611 release, to build its PyPI page.
612
613(6)
614 The ``license`` field is a text indicating the license covering the
615 distribution where the license is not a selection from the "License" Trove
616 classifiers. See the ``Classifier`` field. Notice that
617 there's a ``licence`` distribution option which is deprecated but still
618 acts as an alias for ``license``.
619
620'short string'
621 A single line of text, not more than 200 characters.
622
623'long string'
624 Multiple lines of plain text in reStructuredText format (see
625 http://docutils.sf.net/).
626
627'list of strings'
628 See below.
629
630In Python 2.x, "string value" means a unicode object. If a byte string (str or
631bytes) is given, it has to be valid ASCII.
632
633.. TODO move this section to the version document, keep a summary, add a link
634
635Encoding the version information is an art in itself. Python projects generally
636adhere to the version format *major.minor[.patch][sub]*. The major number is 0
637for initial, experimental releases of software. It is incremented for releases
638that represent major milestones in a project. The minor number is incremented
639when important new features are added to the project. The patch number
640increments when bug-fix releases are made. Additional trailing version
641information is sometimes used to indicate sub-releases. These are
642"a1,a2,...,aN" (for alpha releases, where functionality and API may change),
643"b1,b2,...,bN" (for beta releases, which only fix bugs) and "pr1,pr2,...,prN"
644(for final pre-release release testing). Some examples:
645
6460.1.0
647 the first, experimental release of a project
648
6491.0.1a2
650 the second alpha release of the first patch version of 1.0
651
652:option:`classifiers` are specified in a Python list::
653
654 setup(...,
655 classifiers=[
656 'Development Status :: 4 - Beta',
657 'Environment :: Console',
658 'Environment :: Web Environment',
659 'Intended Audience :: End Users/Desktop',
660 'Intended Audience :: Developers',
661 'Intended Audience :: System Administrators',
662 'License :: OSI Approved :: Python Software Foundation License',
663 'Operating System :: MacOS :: MacOS X',
664 'Operating System :: Microsoft :: Windows',
665 'Operating System :: POSIX',
666 'Programming Language :: Python',
667 'Topic :: Communications :: Email',
668 'Topic :: Office/Business',
669 'Topic :: Software Development :: Bug Tracking',
670 ])
671
672
673Debugging the setup script
674==========================
675
676Sometimes things go wrong, and the setup script doesn't do what the developer
677wants.
678
679Distutils catches any exceptions when running the setup script, and print a
680simple error message before the script is terminated. The motivation for this
681behaviour is to not confuse administrators who don't know much about Python and
682are trying to install a project. If they get a big long traceback from deep
683inside the guts of Distutils, they may think the project or the Python
684installation is broken because they don't read all the way down to the bottom
685and see that it's a permission problem.
686
687.. FIXME DISTUTILS_DEBUG is dead, document logging/warnings here
688
689On the other hand, this doesn't help the developer to find the cause of the
690failure. For this purpose, the DISTUTILS_DEBUG environment variable can be set
691to anything except an empty string, and Packaging will now print detailed
692information about what it is doing, and prints the full traceback in case an
693exception occurs.