Update to PEP 441 from Paul More: swap pack() args, default archive name, support open streams.

This commit is contained in:
Guido van Rossum 2015-02-24 10:34:33 -08:00
parent 4cf8410bc9
commit 17dfaa547e
1 changed files with 15 additions and 11 deletions

View File

@ -90,17 +90,19 @@ Module Interface
The zipapp module will provide the following functions:
``pack(target, directory, interpreter=None, main=None)``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``pack(directory, target=None, interpreter=None, main=None)``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Writes an application archive called *target*, containing the
contents of *directory*. If *interpreter* is specified, it will
be written to the start of the archive as a shebang line and the file
will be made executable (if no interpreter is specified, the shebang
line will be omitted). If the directory contains no ``__main__.py``
file, the function will construct a ``__main__.py`` which calls the
function specified in the *main* argument (which should be in the
form ``'pkg.mod:fn'``).
Writes an application archive called *target*, containing the contents
of *directory*. The *target* can be a filename, or a file-like object
(which must be open for writing in bytes mode), or None (which means
use the name of *directory* with ``.pyz`` appended). If *interpreter*
is specified, it will be written to the start of the archive as a
shebang line and the file will be made executable (if no interpreter
is specified, the shebang line will be omitted). If the directory
contains no ``__main__.py`` file, the function will construct a
``__main__.py`` which calls the function specified in the *main*
argument (which should be in the form ``'pkg.mod:fn'``).
It is an error to specify *main* if the directory contains a
``__main__.py``, or to omit *main* when there is no ``__main__.py``
@ -118,7 +120,9 @@ If there is no shebang, the function returns ``None``.
Modifies the *archive*'s shebang line to contain the specified
interpreter, and writes the updated archive to *new_archive*. If the
*interpreter* is ``None``, removes the shebang line.
*interpreter* is ``None``, removes the shebang line. The
*new_archive* argument can be a filename, or a file-like object open
for writing in byte mode.
Command Line Usage
------------------