Skip to content

bpo-29901: Improve support of path-like objects in zipapp.#815

Merged
serhiy-storchaka merged 1 commit into
python:masterfrom
serhiy-storchaka:zipapp-support-path-like
Mar 25, 2017
Merged

bpo-29901: Improve support of path-like objects in zipapp.#815
serhiy-storchaka merged 1 commit into
python:masterfrom
serhiy-storchaka:zipapp-support-path-like

Conversation

@serhiy-storchaka

Copy link
Copy Markdown
Member

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 A feature request or enhancement label Mar 25, 2017
@mention-bot

Copy link
Copy Markdown

@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.

@pfmoore pfmoore left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Comment thread Lib/zipapp.py
z.write(str(child), arcname)
for child in source.rglob('*'):
arcname = child.relative_to(source).as_posix()
z.write(child, arcname)

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

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
Copy Markdown
Member

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
@serhiy-storchaka serhiy-storchaka deleted the zipapp-support-path-like branch March 25, 2017 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants