summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2017-09-29 17:31:52 (GMT)
committerPaul Moore <p.f.moore@gmail.com>2017-09-29 17:31:52 (GMT)
commitd87b105ca794addf92addb28293c92a7ef4141e1 (patch)
tree65d69e9473d93bb612d4c3fedbfb714626d402f5 /Doc
parent6fb0e4a6d085ffa4e4a6daaea042a1cc517fa8bc (diff)
downloadcpython-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')
-rw-r--r--Doc/library/zipapp.rst17
-rw-r--r--Doc/whatsnew/3.7.rst6
2 files changed, 19 insertions, 4 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)
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index a19a289..a474e76 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -285,9 +285,13 @@ zipapp
------
Function :func:`zipapp.create_archive` now accepts an optional *filter*
-argument, to allow the user to select which files should be included in the
+argument to allow the user to select which files should be included in the
+archive, and an optional *compressed* argument to generate a compressed
archive.
+A command line option ``--compress`` has also been added to support
+compression.
+
Optimizations
=============