Skip to content
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-29901: Improve support of path-like objects in zipapp. #815

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Mar 25, 2017

Now general path-like objects are supported, not just pathlib.Path.

Now general path-like objects are supported, not just pathlib.Path.
@serhiy-storchaka serhiy-storchaka added the type-feature label Mar 25, 2017
@serhiy-storchaka serhiy-storchaka requested a review from pfmoore Mar 25, 2017
@mention-bot
Copy link

@mention-bot mention-bot commented Mar 25, 2017

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @brettcannon, @pfmoore and @terryjreedy to be potential reviewers.

Copy link
Member

@pfmoore pfmoore left a comment

Looks good to me - I made one comment noting a couple of points, but I don't believe they are issues.

z.write(str(child), arcname)
for child in source.rglob('*'):
arcname = child.relative_to(source).as_posix()
z.write(child, arcname)
Copy link
Member

@pfmoore pfmoore Mar 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that ZipFile.write() now takes a general path object, and doesn't require conversion to a string? The docs for that function don't explicitly state this, unlike some other functions in that module, but I assume that's just a documentation oversight.

Also, there's a minor change in behaviour here, as the archive name is always in POSIX format now, whereas before it was in OS-specific format. But IMO that's entirely reasonable (and was an oversight on my part in the original code) so I'm happy with that.

Copy link
Member Author

@serhiy-storchaka serhiy-storchaka Mar 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no behavior change. ZipFile itself converts the archive name to POSIX format. But I think it is better to do this explicitly. Maybe implicit conversion will be deprecated in future.

Copy link
Member

@pfmoore pfmoore Mar 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, OK. I agree, explicit is better here.

@serhiy-storchaka serhiy-storchaka merged commit 4aec9a8 into python:master Mar 25, 2017
3 checks passed
@serhiy-storchaka serhiy-storchaka deleted the zipapp-support-path-like branch Mar 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA signed type-feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants