Skip to content

Remove redundant entrypoint text normalization #8528

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

Merged
merged 1 commit into from
Jul 3, 2020

Conversation

chrahunt
Copy link
Member

@chrahunt chrahunt commented Jul 3, 2020

I wanted to submit this PR separately since the justification requires a little bit of a code dive. I hope that helps!

Currently we do processing in get_entrypoints so incoming text is more compatible
with pkg_resources. It turns out that pkg_resources is already doing the same normalization,
so we can omit it. See parse_map, which calls split_sections, which calls split_sections, which calls yield_lines, where it accepts plain text and strips lines, as we were doing.

This simplifies get_entrypoints, opening the way for us to pass it a plain string (derived from the zip file) instead
of a file path.

Progresses #6030.

Currently we do processing in `get_entrypoints` so incoming text is more compatible
with `pkg_resources`. It turns out that `pkg_resources` is already doing the same normalization,
so we can omit it.

This simplifies `get_entrypoints`, opening the way for us to pass it a plain string instead
of a file path.
@chrahunt chrahunt added the skip news Does not need a NEWS file entry (eg: trivial changes) label Jul 3, 2020
@chrahunt chrahunt marked this pull request as ready for review July 3, 2020 02:26
Copy link
Member

@pradyunsg pradyunsg left a comment

Choose a reason for hiding this comment

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

Looks good to me! Great investigative work figuring this out! ^.^

pradyunsg
pradyunsg approved these changes Jul 3, 2020
pradyunsg
pradyunsg approved these changes Jul 3, 2020
pradyunsg
pradyunsg approved these changes Jul 3, 2020
@pradyunsg
Copy link
Member

(I blame my patchy Internet connection)

@chrahunt chrahunt merged commit 8097de5 into pypa:master Jul 3, 2020
@chrahunt
Copy link
Member Author

chrahunt commented Jul 3, 2020

Thanks for reviewing. :)

@chrahunt chrahunt deleted the simplify-get-entrypoints branch July 3, 2020 13:10
@chrahunt chrahunt added the type: refactor Refactoring code label Jul 4, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
skip news Does not need a NEWS file entry (eg: trivial changes) type: refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants