mirror of
https://github.com/python/cpython.git
synced 2025-11-17 17:46:45 +00:00
add a filterfunc to zip file.PyZipFile.writepy, issue 19274
This commit is contained in:
parent
47f1b762fd
commit
59202e5fc7
4 changed files with 204 additions and 159 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue