[Python-checkins] peps: Update to PEP 441 from Paul More: swap pack() args, default archive name,

guido.van.rossum python-checkins at python.org
Tue Feb 24 19:34:39 CET 2015


https://hg.python.org/peps/rev/4eba4dcec2c7
changeset:   5705:4eba4dcec2c7
user:        Guido van Rossum <guido at python.org>
date:        Tue Feb 24 10:34:33 2015 -0800
summary:
  Update to PEP 441 from Paul More: swap pack() args, default archive name, support open streams.

files:
  pep-0441.txt |  26 +++++++++++++++-----------
  1 files changed, 15 insertions(+), 11 deletions(-)


diff --git a/pep-0441.txt b/pep-0441.txt
--- a/pep-0441.txt
+++ b/pep-0441.txt
@@ -90,17 +90,19 @@
 
 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 @@
 
 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
 ------------------

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list