-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-31072: Add filter to zipapp #3021
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the 2 noted points, the travis check failed with a report of whitespace issues, and the documentation needs to be updated.
Lib/zipapp.py
Outdated
@@ -73,7 +73,8 @@ def _copy_archive(archive, new_archive, interpreter=None): | |||
os.chmod(new_archive, os.stat(new_archive).st_mode | stat.S_IEXEC) | |||
|
|||
|
|||
def create_archive(source, target=None, interpreter=None, main=None): | |||
def create_archive(source, target=None, interpreter=None, main=None, | |||
include_file=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation needs fixing here
Lib/zipapp.py
Outdated
@@ -134,8 +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() | |||
z.write(child, arcname) | |||
if include_file is None or include_file(pathlib.Path(child)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The include_file
check should take arcfile
as argument - specifically it should be passed a path that is relative to the source directory.
Thanks for the PR on this - I've made a couple of comments that need to be addressed, but basically the change looks good. I'm going to be unable to get back to this for a week or so, so if I don't comment any further for a while, don't worry - I will get back to it! |
I've added a NEWS entry to your PR. Otherwise, this looks good to go. |
Thanks for the contribution! |
https://bugs.python.org/issue31072