diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2017-09-29 17:31:52 (GMT) |
---|---|---|
committer | Paul Moore <p.f.moore@gmail.com> | 2017-09-29 17:31:52 (GMT) |
commit | d87b105ca794addf92addb28293c92a7ef4141e1 (patch) | |
tree | 65d69e9473d93bb612d4c3fedbfb714626d402f5 /Doc/library/zipapp.rst | |
parent | 6fb0e4a6d085ffa4e4a6daaea042a1cc517fa8bc (diff) | |
download | cpython-d87b105ca794addf92addb28293c92a7ef4141e1.zip cpython-d87b105ca794addf92addb28293c92a7ef4141e1.tar.gz cpython-d87b105ca794addf92addb28293c92a7ef4141e1.tar.bz2 |
bpo-31638: Add compression support to zipapp (GH-3819)
Add optional argument `compressed` to `zipapp.create_archive`, and add
option `--compress` to the command line interface of `zipapp`.
Diffstat (limited to 'Doc/library/zipapp.rst')
-rw-r--r-- | Doc/library/zipapp.rst | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Doc/library/zipapp.rst b/Doc/library/zipapp.rst index 120bbbb..2bd65cb 100644 --- a/Doc/library/zipapp.rst +++ b/Doc/library/zipapp.rst @@ -79,6 +79,13 @@ The following options are understood: :option:`--main` cannot be specified when copying an archive. +.. cmdoption:: -c, --compress + + Compress files with the deflate method, reducing the size of the output + file. By default, files are stored uncompressed in the archive. + + :option:`--compress` has no effect when copying an archive. + .. cmdoption:: --info Display the interpreter embedded in the archive, for diagnostic purposes. In @@ -98,8 +105,7 @@ Python API The module defines two convenience functions: -.. function:: create_archive(source, target=None, interpreter=None, main=None, - filter=None) +.. function:: create_archive(source, target=None, interpreter=None, main=None, filter=None, compressed=False) Create an application archive from *source*. The source can be any of the following: @@ -149,6 +155,11 @@ The module defines two convenience functions: (relative to the source directory). It should return ``True`` if the file is to be added. + The optional *compressed* argument determines whether files are + compressed. If set to ``True``, files in the archive are compressed + with the deflate method; otherwise, files are stored uncompressed. + This argument has no effect when copying an existing archive. + If a file object is specified for *source* or *target*, it is the caller's responsibility to close it after calling create_archive. @@ -159,7 +170,7 @@ The module defines two convenience functions: needed by that class. .. versionadded:: 3.7 - Added the *filter* argument. + Added the *filter* and *compressed* arguments. .. function:: get_interpreter(archive) |