summaryrefslogtreecommitdiff
path: root/Lib/zipapp.py
diff options
context:
space:
mode:
authorPaul Moore <p.f.moore@gmail.com>2017-08-26 18:04:12 +0100
committerGitHub <noreply@github.com>2017-08-26 18:04:12 +0100
commit0780bf7578dc4c9c3852dc5e869aba515a2c65b1 (patch)
treedb073e0b76aabdb567564e917bc92239e5109f2b /Lib/zipapp.py
parenta5b4ea15b61e3f3985f4f0748a18f8b888a63532 (diff)
downloadcpython-git-0780bf7578dc4c9c3852dc5e869aba515a2c65b1.tar.gz
bpo-31072: Rename the new filter argument for zipapp.create_archive. (#3049)
bpo-31072: Rename the new filter argument for zipapp.create_archive (GH-3049) * Rename the new argument to "filter" * Improve tests for the new functionality * Add a "What's New" entry.
Diffstat (limited to 'Lib/zipapp.py')
-rw-r--r--Lib/zipapp.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/zipapp.py b/Lib/zipapp.py
index bf15b6806d..51d0290a90 100644
--- a/Lib/zipapp.py
+++ b/Lib/zipapp.py
@@ -74,7 +74,7 @@ def _copy_archive(archive, new_archive, interpreter=None):
def create_archive(source, target=None, interpreter=None, main=None,
- include_file=None):
+ filter=None):
"""Create an application archive from SOURCE.
The SOURCE can be the name of a directory, or a filename or a file-like
@@ -135,9 +135,9 @@ def create_archive(source, target=None, interpreter=None, main=None,
_write_file_prefix(fd, interpreter)
with zipfile.ZipFile(fd, 'w') as z:
for child in source.rglob('*'):
- arcname = child.relative_to(source).as_posix()
- if include_file is None or include_file(pathlib.Path(arcname)):
- z.write(child, arcname)
+ arcname = child.relative_to(source)
+ if filter is None or filter(arcname):
+ z.write(child, arcname.as_posix())
if main_py:
z.writestr('__main__.py', main_py.encode('utf-8'))