Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/zipimport.rst

    r2 r391  
    1313:file:`\*.py[co]`) and packages from ZIP-format archives. It is usually not
    1414needed to use the :mod:`zipimport` module explicitly; it is automatically used
    15 by the built-in :keyword:`import` mechanism for ``sys.path`` items that are paths
     15by the built-in :keyword:`import` mechanism for :data:`sys.path` items that are paths
    1616to ZIP archives.
    1717
    18 Typically, ``sys.path`` is a list of directory names as strings.  This module
    19 also allows an item of ``sys.path`` to be a string naming a ZIP file archive.
     18Typically, :data:`sys.path` is a list of directory names as strings.  This module
     19also allows an item of :data:`sys.path` to be a string naming a ZIP file archive.
    2020The ZIP archive can contain a subdirectory structure to support package imports,
    2121and a path within the archive can be specified to only import from a
    22 subdirectory.  For example, the path :file:`/tmp/example.zip/lib/` would only
     22subdirectory.  For example, the path :file:`example.zip/lib/` would only
    2323import from the :file:`lib/` subdirectory within the archive.
    2424
     
    3434since this would imply that the ZIP has been altered during runtime.
    3535
     36ZIP archives with an archive comment are currently not supported.
     37
    3638.. seealso::
    3739
     
    4042      algorithms used.
    4143
    42    :pep:`0273` - Import Modules from Zip Archives
     44   :pep:`273` - Import Modules from Zip Archives
    4345      Written by James C. Ahlstrom, who also provided an implementation. Python 2.3
    4446      follows the specification in PEP 273, but uses an implementation written by Just
    4547      van Rossum that uses the import hooks described in PEP 302.
    4648
    47    :pep:`0302` - New Import Hooks
     49   :pep:`302` - New Import Hooks
    4850      The PEP to add the import hooks that help this module work.
    4951
     
    9597
    9698
     99   .. method:: get_filename(fullname)
     100
     101      Return the value ``__file__`` would be set to if the specified module
     102      was imported. Raise :exc:`ZipImportError` if the module couldn't be
     103      found.
     104
     105   .. versionadded:: 2.7
     106
     107
    97108   .. method:: get_source(fullname)
    98109
     
    141152:mod:`zipimport` module is not explicitly used. ::
    142153
    143    $ unzip -l /tmp/example.zip
    144    Archive:  /tmp/example.zip
     154   $ unzip -l example.zip
     155   Archive:  example.zip
    145156     Length     Date   Time    Name
    146157    --------    ----   ----    ----
     
    151162   Python 2.3 (#1, Aug 1 2003, 19:54:32)
    152163   >>> import sys
    153    >>> sys.path.insert(0, '/tmp/example.zip')  # Add .zip file to front of path
     164   >>> sys.path.insert(0, 'example.zip')  # Add .zip file to front of path
    154165   >>> import jwzthreading
    155166   >>> jwzthreading.__file__
    156    '/tmp/example.zip/jwzthreading.py'
     167   'example.zip/jwzthreading.py'
    157168
Note: See TracChangeset for help on using the changeset viewer.