From 17dfaa547e989624e606c95f161ca1373119903e Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 24 Feb 2015 10:34:33 -0800 Subject: [PATCH] Update to PEP 441 from Paul More: swap pack() args, default archive name, support open streams. --- pep-0441.txt | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/pep-0441.txt b/pep-0441.txt index f0e283747..8ca56031e 100644 --- a/pep-0441.txt +++ b/pep-0441.txt @@ -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 ------------------