Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Fix "Should be unreachable in pip8" caused by inconsistent use of normalization #205

Merged
merged 3 commits into from
Nov 9, 2017

Conversation

chriskuehl
Copy link
Contributor

Fixes #202

@asottile can you think of a better way to implement this?

I think the ideal way would be to capture the name of the installed package right after it's installed, but it doesn't appear that pip does that, and patching that + threading the resulting name all the way back to our code sounds unpleasant.

Or maybe WorkingSet already has a way to find a normalized name, but I couldn't find one.

@chriskuehl chriskuehl changed the title Fix normalization Fix "Should be unreachable in pip8" caused by inconsistent use of normalization Nov 9, 2017
@Yelp Yelp deleted a comment from codecov-io Nov 9, 2017
def normalize_name(name):
"""Normalize a python package name a la PEP 503"""
# https://www.python.org/dev/peps/pep-0503/#normalized-names
return re.sub('[-_.]+', '-', name).lower()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

stolen verbatim from distutils

Copy link
Contributor

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

'pypi-server', '-vvvvvv',
'-i', '127.0.0.1',
'-p', port,
# Default fallback is HTTP, which is no longer supported.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe a todo to remove this once a new enough pypiserver is released? or install pypiserver from git temporarily?

@Yelp Yelp deleted a comment from codecov-io Nov 9, 2017
@chriskuehl chriskuehl merged commit c873216 into master Nov 9, 2017
@chriskuehl chriskuehl deleted the fix-normalization branch November 9, 2017 21:56
@codecov-io
Copy link

codecov-io commented Nov 9, 2017

Codecov Report

Merging #205 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #205   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          39     40    +1     
  Lines        1826   1849   +23     
  Branches      105    105           
=====================================
+ Hits         1826   1849   +23
Impacted Files Coverage Δ
tests/functional/pip_faster.py 100% <ø> (ø) ⬆️
pip_faster.py 100% <100%> (ø) ⬆️
tests/functional/simple_test.py 100% <100%> (ø) ⬆️
tests/conftest.py 100% <100%> (ø) ⬆️
...ests/testing/packages/dotted_package_name/setup.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c33a5a1...536ff77. Read the comment docs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants