Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
59202e5f
Commit
59202e5f
authored
Oct 21, 2013
by
Christian Tismer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a filterfunc to zip file.PyZipFile.writepy, issue 19274
parent
47f1b762
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
204 additions
and
159 deletions
+204
-159
Doc/library/zipfile.rst
Doc/library/zipfile.rst
+8
-2
Doc/whatsnew/3.4.rst
Doc/whatsnew/3.4.rst
+10
-0
Lib/test/test_zipfile.py
Lib/test/test_zipfile.py
+102
-80
Lib/zipfile.py
Lib/zipfile.py
+84
-77
No files found.
Doc/library/zipfile.rst
View file @
59202e5f
...
...
@@ -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
...
...
Doc/whatsnew/3.4.rst
View file @
59202e5f
...
...
@@ -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
==================
...
...
Lib/test/test_zipfile.py
View file @
59202e5f
This diff is collapsed.
Click to expand it.
Lib/zipfile.py
View file @
59202e5f
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment