]> granicus.if.org Git - python/commitdiff
Merge with 3.2.
authorEzio Melotti <ezio.melotti@gmail.com>
Wed, 19 Oct 2011 08:06:26 +0000 (11:06 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Wed, 19 Oct 2011 08:06:26 +0000 (11:06 +0300)
20 files changed:
1  2 
Doc/c-api/exceptions.rst
Doc/distutils/apiref.rst
Doc/library/argparse.rst
Doc/library/collections.rst
Doc/library/concurrent.futures.rst
Doc/library/ctypes.rst
Doc/library/functions.rst
Doc/library/mmap.rst
Doc/library/multiprocessing.rst
Doc/library/os.rst
Doc/library/packaging.command.rst
Doc/library/packaging.install.rst
Doc/library/sqlite3.rst
Doc/library/stdtypes.rst
Doc/library/threading.rst
Lib/configparser.py
Lib/datetime.py
Lib/test/test_urllib2.py
Lib/threading.py
Lib/turtle.py

index 2fd5145de9c068ac1b22fe3aa9f0fc9d1264225d,6f13c8035a0f26b1401293668eb6c49292003e03..c7252edce438b5f9d3f32a1b0619b5236756df94
@@@ -525,7 -525,7 +525,7 @@@ recursion depth automatically)
  
     Marks a point where a recursive C-level call is about to be performed.
  
--   If :const:`USE_STACKCHECK` is defined, this function checks if the the OS
++   If :const:`USE_STACKCHECK` is defined, this function checks if the OS
     stack overflowed using :c:func:`PyOS_CheckStack`.  In this is the case, it
     sets a :exc:`MemoryError` and returns a nonzero value.
  
Simple merge
index 5a211e1d4a1e62a7fccfe878fb16d79bc21c41c4,88270edf89c746ff8d8d368a575939f2b6e4ad71..7c7319ef6f15b99fd62462df0a600c0519a2db6c
@@@ -442,25 -442,6 +442,25 @@@ default values to each of the argument 
      -h, --help  show this help message and exit
      --foo FOO   FOO! (default: 42)
  
- argument as as the display name for its values (rather than using the dest_
 +:class:`MetavarTypeHelpFormatter` uses the name of the type_ argument for each
++argument as the display name for its values (rather than using the dest_
 +as the regular formatter does)::
 +
 +   >>> parser = argparse.ArgumentParser(
 +   ...     prog='PROG',
 +   ...     formatter_class=argparse.MetavarTypeHelpFormatter)
 +   >>> parser.add_argument('--foo', type=int)
 +   >>> parser.add_argument('bar', type=float)
 +   >>> parser.print_help()
 +   usage: PROG [-h] [--foo int] float
 +
 +   positional arguments:
 +     float
 +
 +   optional arguments:
 +     -h, --help  show this help message and exit
 +     --foo int
 +
  
  conflict_handler
  ^^^^^^^^^^^^^^^^
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index fe7e7056d44d52ea9f2b75fc59e4f0f80909896f,ea788d31f86a908b7994b5040d16edc93bee593f..6adfdb18916d2b282ee09e42a8650d2f8e604b95
@@@ -1323,17 -818,6 +1323,17 @@@ as internal buffering of data
        :meth:`~file.write` method.
  
  
-    Write the the contents of *buffers* to file descriptor *fd*, where *buffers*
 +.. function:: writev(fd, buffers)
 +
++   Write the contents of *buffers* to file descriptor *fd*, where *buffers*
 +   is an arbitrary sequence of buffers.
 +   Returns the total number of bytes written.
 +
 +   Availability: Unix.
 +
 +   .. versionadded:: 3.3
 +
 +
  .. _open-constants:
  
  ``open()`` flag constants
index 98835c075613f598c5267d868e7a4970a1a6eaf6,0000000000000000000000000000000000000000..6a85351728f35401c28099c63fcc52a954358fd0
mode 100644,000000..100644
--- /dev/null
@@@ -1,111 -1,0 +1,111 @@@
-    to to code option dependencies: if *foo* depends on *bar*, then it is safe to
 +:mod:`packaging.command` --- Standard Packaging commands
 +========================================================
 +
 +.. module:: packaging.command
 +   :synopsis: Standard packaging commands.
 +
 +
 +This subpackage contains one module for each standard Packaging command, such as
 +:command:`build`  or :command:`upload`.  Each command is implemented as a
 +separate module, with the command name as the name of the module and of the
 +class defined therein.
 +
 +
 +
 +:mod:`packaging.command.cmd` --- Abstract base class for Packaging commands
 +===========================================================================
 +
 +.. module:: packaging.command.cmd
 +   :synopsis: Abstract base class for commands.
 +
 +
 +This module supplies the abstract base class :class:`Command`.  This class is
 +subclassed by the modules in the packaging.command subpackage.
 +
 +
 +.. class:: Command(dist)
 +
 +   Abstract base class for defining command classes, the "worker bees" of the
 +   Packaging.  A useful analogy for command classes is to think of them as
 +   subroutines with local variables called *options*.  The options are declared
 +   in :meth:`initialize_options` and defined (given their final values) in
 +   :meth:`finalize_options`, both of which must be defined by every command
 +   class.  The distinction between the two is necessary because option values
 +   might come from the outside world (command line, config file, ...), and any
 +   options dependent on other options must be computed after these outside
 +   influences have been processed --- hence :meth:`finalize_options`.  The body
 +   of the subroutine, where it does all its work based on the values of its
 +   options, is the :meth:`run` method, which must also be implemented by every
 +   command class.
 +
 +   The class constructor takes a single argument *dist*, a
 +   :class:`~packaging.dist.Distribution` instance.
 +
 +
 +Creating a new Packaging command
 +--------------------------------
 +
 +This section outlines the steps to create a new Packaging command.
 +
 +.. XXX the following paragraph is focused on the stdlib; expand it to document
 +   how to write and register a command in third-party projects
 +
 +A new command lives in a module in the :mod:`packaging.command` package. There
 +is a sample template in that directory called :file:`command_template`.  Copy
 +this file to a new module with the same name as the new command you're
 +implementing.  This module should implement a class with the same name as the
 +module (and the command).  So, for instance, to create the command
 +``peel_banana`` (so that users can run ``setup.py peel_banana``), you'd copy
 +:file:`command_template` to :file:`packaging/command/peel_banana.py`, then edit
 +it so that it's implementing the class :class:`peel_banana`, a subclass of
 +:class:`Command`.  It must define the following methods:
 +
 +.. method:: Command.initialize_options()
 +
 +   Set default values for all the options that this command supports.  Note that
 +   these defaults may be overridden by other commands, by the setup script, by
 +   config files, or by the command line.  Thus, this is not the place to code
 +   dependencies between options; generally, :meth:`initialize_options`
 +   implementations are just a bunch of ``self.foo = None`` assignments.
 +
 +
 +.. method:: Command.finalize_options()
 +
 +   Set final values for all the options that this command supports. This is
 +   always called as late as possible, i.e. after any option assignments from the
 +   command line or from other commands have been done.  Thus, this is the place
++   to code option dependencies: if *foo* depends on *bar*, then it is safe to
 +   set *foo* from *bar* as long as *foo* still has the same value it was
 +   assigned in :meth:`initialize_options`.
 +
 +
 +.. method:: Command.run()
 +
 +   A command's raison d'etre: carry out the action it exists to perform,
 +   controlled by the options initialized in :meth:`initialize_options`,
 +   customized by other commands, the setup script, the command line, and config
 +   files, and finalized in :meth:`finalize_options`.  All terminal output and
 +   filesystem interaction should be done by :meth:`run`.
 +
 +
 +Command classes may define this attribute:
 +
 +
 +.. attribute:: Command.sub_commands
 +
 +   *sub_commands* formalizes the notion of a "family" of commands,
 +   e.g. ``install_dist`` as the parent with sub-commands ``install_lib``,
 +   ``install_headers``, etc.  The parent of a family of commands defines
 +   *sub_commands* as a class attribute; it's a list of 2-tuples ``(command_name,
 +   predicate)``, with *command_name* a string and *predicate* a function, a
 +   string or ``None``.  *predicate* is a method of the parent command that
 +   determines whether the corresponding command is applicable in the current
 +   situation.  (E.g. ``install_headers`` is only applicable if we have any C
 +   header files to install.)  If *predicate* is ``None``, that command is always
 +   applicable.
 +
 +   *sub_commands* is usually defined at the *end* of a class, because
 +   predicates can be methods of the class, so they must already have been
 +   defined.  The canonical example is the :command:`install_dist` command.
 +
 +.. XXX document how to add a custom command to another one's subcommands
index b619a98e2eba4035e417d77479a02c770fd40553,0000000000000000000000000000000000000000..3e00750988fc32a4dee0583a8267b3508a0ac130
mode 100644,000000..100644
--- /dev/null
@@@ -1,112 -1,0 +1,112 @@@
-    *requirements* is a string string containing the requirements for this
 +:mod:`packaging.install` --- Installation tools
 +===============================================
 +
 +.. module:: packaging.install
 +   :synopsis: Download and installation building blocks
 +
 +
 +Packaging provides a set of tools to deal with downloads and installation of
 +distributions.  Their role is to download the distribution from indexes, resolve
 +the dependencies, and provide a safe way to install distributions.  An operation
 +that fails will cleanly roll back, not leave half-installed distributions on the
 +system.  Here's the basic process followed:
 +
 +#. Move all distributions that will be removed to a temporary location.
 +
 +#. Install all the distributions that will be installed in a temporary location.
 +
 +#. If the installation fails, move the saved distributions back to their
 +   location and delete the installed distributions.
 +
 +#. Otherwise, move the installed distributions to the right location and delete
 +   the temporary locations.
 +
 +This is a higher-level module built on :mod:`packaging.database` and
 +:mod:`packaging.pypi`.
 +
 +
 +Public functions
 +----------------
 +
 +.. function:: get_infos(requirements, index=None, installed=None, \
 +                        prefer_final=True)
 +
 +   Return information about what's going to be installed and upgraded.
++   *requirements* is a string containing the requirements for this
 +   project, for example ``'FooBar 1.1'`` or ``'BarBaz (<1.2)'``.
 +
 +   .. XXX are requirements comma-separated?
 +
 +   If you want to use another index than the main PyPI, give its URI as *index*
 +   argument.
 +
 +   *installed* is a list of already installed distributions used to find
 +   satisfied dependencies, obsoleted distributions and eventual conflicts.
 +
 +   By default, alpha, beta and candidate versions are not picked up.  Set
 +   *prefer_final* to false to accept them too.
 +
 +   The results are returned in a dictionary containing all the information
 +   needed to perform installation of the requirements with the
 +   :func:`install_from_infos` function:
 +
 +   >>> get_install_info("FooBar (<=1.2)")
 +   {'install': [<FooBar 1.1>], 'remove': [], 'conflict': []}
 +
 +   .. TODO should return tuple or named tuple, not dict
 +   .. TODO use "predicate" or "requirement" consistently in version and here
 +   .. FIXME "info" cannot be plural in English, s/infos/info/
 +
 +
 +.. function:: install(project)
 +
 +
 +.. function:: install_dists(dists, path, paths=None)
 +
 +   Safely install all distributions provided in *dists* into *path*.  *paths* is
 +   a list of paths where already-installed distributions will be looked for to
 +   find satisfied dependencies and conflicts (default: :data:`sys.path`).
 +   Returns a list of installed dists.
 +
 +   .. FIXME dists are instances of what?
 +
 +
 +.. function:: install_from_infos(install_path=None, install=[], remove=[], \
 +                                 conflicts=[], paths=None)
 +
 +   Safely install and remove given distributions.  This function is designed to
 +   work with the return value of :func:`get_infos`: *install*, *remove* and
 +   *conflicts* should be list of distributions returned by :func:`get_infos`.
 +   If *install* is not empty, *install_path* must be given to specify the path
 +   where the distributions should be installed.  *paths* is a list of paths
 +   where already-installed distributions will be looked for (default:
 +   :data:`sys.path`).
 +
 +   This function is a very basic installer; if *conflicts* is not empty, the
 +   system will be in a conflicting state after the function completes.  It is a
 +   building block for more sophisticated installers with conflict resolution
 +   systems.
 +
 +   .. TODO document typical value for install_path
 +   .. TODO document integration with default schemes, esp. user site-packages
 +
 +
 +.. function:: install_local_project(path)
 +
 +   Install a distribution from a source directory, which must contain either a
 +   Packaging-compliant :file:`setup.cfg` file or a legacy Distutils
 +   :file:`setup.py` script (in which case Distutils will be used under the hood
 +   to perform the installation).
 +
 +
 +.. function::  remove(project_name, paths=None, auto_confirm=True)
 +
 +   Remove one distribution from the system.
 +
 +   .. FIXME this is the only function using "project" instead of dist/release
 +
 +..
 +   Example usage
 +   --------------
 +
 +   Get the scheme of what's gonna be installed if we install "foobar":
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc Lib/datetime.py
Simple merge
Simple merge
Simple merge
diff --cc Lib/turtle.py
Simple merge