@@ -21,9 +21,7 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and
2121.. function :: setup(arguments)
2222
2323 The basic do-everything function that does most everything you could ever ask
24- for from a Distutils method.
25-
26- .. See XXXXX
24+ for from a Distutils method. See XXXXX
2725
2826 The setup function takes a large number of arguments. These are laid out in the
2927 following table.
@@ -149,11 +147,11 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and
149147In addition, the :mod: `distutils.core ` module exposed a number of classes that
150148live elsewhere.
151149
152- * :class: `~distutils.extension. Extension ` from :mod: `distutils.extension `
150+ * :class: `Extension ` from :mod: `distutils.extension `
153151
154- * :class: `~distutils.cmd. Command ` from :mod: `distutils.cmd `
152+ * :class: `Command ` from :mod: `distutils.cmd `
155153
156- * :class: `~distutils.dist. Distribution ` from :mod: `distutils.dist `
154+ * :class: `Distribution ` from :mod: `distutils.dist `
157155
158156A short description of each of these follows, but see the relevant module for
159157the full reference.
@@ -997,7 +995,7 @@ directories.
997995 errors are ignored (apart from being reported to ``sys.stdout `` if *verbose * is
998996 true).
999997
1000- .. XXX Some of this could be replaced with the shutil module?
998+ ** \*\* ** Some of this could be replaced with the shutil module? ** \*\* **
1001999
10021000
10031001:mod: `distutils.file_util ` --- Single file operations
@@ -1313,7 +1311,8 @@ provides the following additional features:
13131311 the "negative alias" of :option: `--verbose `, then :option: `--quiet ` on the
13141312 command line sets *verbose * to false.
13151313
1316- .. XXX Should be replaced with :mod:`optparse`.
1314+ **\*\* ** Should be replaced with :mod: `optik ` (which is also now known as
1315+ :mod: `optparse ` in Python 2.3 and later). **\*\* **
13171316
13181317
13191318.. function :: fancy_getopt(options, negative_opt, object, args)
@@ -1681,8 +1680,8 @@ lines, and joining lines with backslashes.
16811680===================================================================
16821681
16831682.. module :: distutils.cmd
1684- :synopsis: This module provides the abstract base class Command. This class
1685- is subclassed by the modules in the distutils.command subpackage.
1683+ :synopsis: This module provides the abstract base class Command. This class is subclassed
1684+ by the modules in the distutils.command subpackage.
16861685
16871686
16881687This module supplies the abstract base class :class: `Command `.
@@ -1692,84 +1691,20 @@ This module supplies the abstract base class :class:`Command`.
16921691
16931692 Abstract base class for defining command classes, the "worker bees" of the
16941693 Distutils. A useful analogy for command classes is to think of them as
1695- subroutines with local variables called *options *. The options are declared
1696- in :meth: `initialize_options ` and defined (given their final values) in
1697- :meth: `finalize_options `, both of which must be defined by every command
1698- class. The distinction between the two is necessary because option values
1699- might come from the outside world (command line, config file, ...), and any
1700- options dependent on other options must be computed after these outside
1701- influences have been processed --- hence :meth: `finalize_options `. The body
1702- of the subroutine, where it does all its work based on the values of its
1703- options, is the :meth: `run ` method, which must also be implemented by every
1704- command class.
1705-
1706- The class constructor takes a single argument *dist *, a :class: `Distribution `
1694+ subroutines with local variables called *options *. The options are declared in
1695+ :meth: `initialize_options ` and defined (given their final values) in
1696+ :meth: `finalize_options `, both of which must be defined by every command class.
1697+ The distinction between the two is necessary because option values might come
1698+ from the outside world (command line, config file, ...), and any options
1699+ dependent on other options must be computed after these outside influences have
1700+ been processed --- hence :meth: `finalize_options `. The body of the subroutine,
1701+ where it does all its work based on the values of its options, is the
1702+ :meth: `run ` method, which must also be implemented by every command class.
1703+
1704+ The class constructor takes a single argument *dist *, a :class: `Distribution `
17071705 instance.
17081706
17091707
1710- Creating a new Distutils command
1711- ================================
1712-
1713- This section outlines the steps to create a new Distutils command.
1714-
1715- A new command lives in a module in the :mod: `distutils.command ` package. There
1716- is a sample template in that directory called :file: `command_template `. Copy
1717- this file to a new module with the same name as the new command you're
1718- implementing. This module should implement a class with the same name as the
1719- module (and the command). So, for instance, to create the command
1720- ``peel_banana `` (so that users can run ``setup.py peel_banana ``), you'd copy
1721- :file: `command_template ` to :file: `distutils/command/peel_banana.py `, then edit
1722- it so that it's implementing the class :class: `peel_banana `, a subclass of
1723- :class: `distutils.cmd.Command `.
1724-
1725- Subclasses of :class: `Command ` must define the following methods.
1726-
1727- .. method :: Command.initialize_options()
1728-
1729- Set default values for all the options that this command supports. Note that
1730- these defaults may be overridden by other commands, by the setup script, by
1731- config files, or by the command-line. Thus, this is not the place to code
1732- dependencies between options; generally, :meth: `initialize_options `
1733- implementations are just a bunch of ``self.foo = None `` assignments.
1734-
1735-
1736- .. method :: Command.finalize_options()
1737-
1738- Set final values for all the options that this command supports. This is
1739- always called as late as possible, ie. after any option assignments from the
1740- command-line or from other commands have been done. Thus, this is the place
1741- to to code option dependencies: if *foo * depends on *bar *, then it is safe to
1742- set *foo * from *bar * as long as *foo * still has the same value it was
1743- assigned in :meth: `initialize_options `.
1744-
1745-
1746- .. method :: Command.run()
1747-
1748- A command's raison d'etre: carry out the action it exists to perform,
1749- controlled by the options initialized in :meth: `initialize_options `,
1750- customized by other commands, the setup script, the command-line, and config
1751- files, and finalized in :meth: `finalize_options `. All terminal output and
1752- filesystem interaction should be done by :meth: `run `.
1753-
1754-
1755- .. attribute :: Command.sub_commands
1756-
1757- *sub_commands * formalizes the notion of a "family" of commands,
1758- e.g. ``install `` as the parent with sub-commands ``install_lib ``,
1759- ``install_headers ``, etc. The parent of a family of commands defines
1760- *sub_commands * as a class attribute; it's a list of 2-tuples ``(command_name,
1761- predicate) ``, with *command_name * a string and *predicate * a function, a
1762- string or ``None ``. *predicate * is a method of the parent command that
1763- determines whether the corresponding command is applicable in the current
1764- situation. (E.g. we ``install_headers `` is only applicable if we have any C
1765- header files to install.) If *predicate * is ``None ``, that command is always
1766- applicable.
1767-
1768- *sub_commands * is usually defined at the *end * of a class, because
1769- predicates can be methods of the class, so they must already have been
1770- defined. The canonical example is the :command: `install ` command.
1771-
1772-
17731708:mod: `distutils.command ` --- Individual Distutils commands
17741709==========================================================
17751710
@@ -2008,3 +1943,76 @@ The ``register`` command registers the package with the Python Package Index.
20081943This is described in more detail in :pep: `301 `.
20091944
20101945.. % todo
1946+
1947+ :mod: `distutils.command.check ` --- Check the meta-data of a package
1948+ ===================================================================
1949+
1950+ .. module :: distutils.command.check
1951+ :synopsis: Check the metadata of a package
1952+
1953+
1954+ The ``check `` command performs some tests on the meta-data of a package.
1955+ For example, it verifies that all required meta-data are provided as
1956+ the arguments passed to the :func: `setup ` function.
1957+
1958+ .. % todo
1959+
1960+
1961+ Creating a new Distutils command
1962+ ================================
1963+
1964+ This section outlines the steps to create a new Distutils command.
1965+
1966+ A new command lives in a module in the :mod: `distutils.command ` package. There
1967+ is a sample template in that directory called :file: `command_template `. Copy
1968+ this file to a new module with the same name as the new command you're
1969+ implementing. This module should implement a class with the same name as the
1970+ module (and the command). So, for instance, to create the command
1971+ ``peel_banana `` (so that users can run ``setup.py peel_banana ``), you'd copy
1972+ :file: `command_template ` to :file: `distutils/command/peel_banana.py `, then edit
1973+ it so that it's implementing the class :class: `peel_banana `, a subclass of
1974+ :class: `distutils.cmd.Command `.
1975+
1976+ Subclasses of :class: `Command ` must define the following methods.
1977+
1978+
1979+ .. method :: Command.initialize_options()
1980+
1981+ Set default values for all the options that this command supports. Note that
1982+ these defaults may be overridden by other commands, by the setup script, by
1983+ config files, or by the command-line. Thus, this is not the place to code
1984+ dependencies between options; generally, :meth: `initialize_options `
1985+ implementations are just a bunch of ``self.foo = None `` assignments.
1986+
1987+
1988+ .. method :: Command.finalize_options()
1989+
1990+ Set final values for all the options that this command supports. This is
1991+ always called as late as possible, ie. after any option assignments from the
1992+ command-line or from other commands have been done. Thus, this is the place
1993+ to to code option dependencies: if *foo * depends on *bar *, then it is safe to
1994+ set *foo * from *bar * as long as *foo * still has the same value it was
1995+ assigned in :meth: `initialize_options `.
1996+
1997+
1998+ .. method :: Command.run()
1999+
2000+ A command's raison d'etre: carry out the action it exists to perform, controlled
2001+ by the options initialized in :meth: `initialize_options `, customized by other
2002+ commands, the setup script, the command-line, and config files, and finalized in
2003+ :meth: `finalize_options `. All terminal output and filesystem interaction should
2004+ be done by :meth: `run `.
2005+
2006+ *sub_commands * formalizes the notion of a "family" of commands, eg. ``install ``
2007+ as the parent with sub-commands ``install_lib ``, ``install_headers ``, etc. The
2008+ parent of a family of commands defines *sub_commands * as a class attribute; it's
2009+ a list of 2-tuples ``(command_name, predicate) ``, with *command_name * a string
2010+ and *predicate * a function, a string or None. *predicate * is a method of
2011+ the parent command that determines whether the corresponding command is
2012+ applicable in the current situation. (Eg. we ``install_headers `` is only
2013+ applicable if we have any C header files to install.) If *predicate * is None,
2014+ that command is always applicable.
2015+
2016+ *sub_commands * is usually defined at the \* end\* of a class, because predicates
2017+ can be methods of the class, so they must already have been defined. The
2018+ canonical example is the :command: `install ` command.
0 commit comments