diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/zipfile.rst | 10 | ||||
-rw-r--r-- | Doc/whatsnew/3.4.rst | 10 |
2 files changed, 18 insertions, 2 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst index 1c81262..3ca20de 100644 --- a/Doc/library/zipfile.rst +++ b/Doc/library/zipfile.rst @@ -382,7 +382,10 @@ The :class:`PyZipFile` constructor takes the same parameters as the Instances have one method in addition to those of :class:`ZipFile` objects: - .. method:: PyZipFile.writepy(pathname, basename='') + .. method:: PyZipFile.writepy(pathname, basename='', filterfunc=None) + + .. versionadded:: 3.4 + The *filterfunc* parameter. Search for files :file:`\*.py` and add the corresponding file to the archive. @@ -404,7 +407,10 @@ The :class:`PyZipFile` constructor takes the same parameters as the package directory, then all :file:`\*.py[co]` are added under the package name as a file path, and if any subdirectories are package directories, all of these are added recursively. *basename* is intended for internal - use only. The :meth:`writepy` method makes archives with file names like + use only. When *filterfunc(pathname)* is given, it will be called for every + invocation. When it returns a False value, that path and its subpaths will + be ignored. + The :meth:`writepy` method makes archives with file names like this:: string.pyc # Top level name diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 2b68d86..c02b9cc 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -564,6 +564,16 @@ Add an event-driven parser for non-blocking applications, (Contributed by Antoine Pitrou in :issue:`17741`.) + +zipfile.PyZipfile +----------------- + +Add a filter function to ignore some packages (tests for instance), +:meth:`~zipfile.PyZipFile.writepy`. + +(Contributed by Christian Tismer in :issue:`19274`.) + + Other improvements ================== |