Skip to content

Commit

Permalink
Canonicalize FrozenRequirement name for correct comparison
Browse files Browse the repository at this point in the history
- Fixes pypa#5716
  • Loading branch information
abs51295 committed Aug 11, 2019
1 parent 2bfafc9 commit f38b729
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions news/5716.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix case sensitive comparison of pip freeze when used with -r option.
9 changes: 5 additions & 4 deletions src/pip/_internal/operations/freeze.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def freeze(
" (add #egg=PackageName to the URL to avoid"
" this warning)"
)
elif line_req.name not in installations:
elif canonicalize_name(line_req.name) not in installations:
# either it's not installed, or it is installed
# but has been processed already
if not req_files[line_req.name]:
Expand All @@ -151,8 +151,9 @@ def freeze(
else:
req_files[line_req.name].append(req_file_path)
else:
yield str(installations[line_req.name]).rstrip()
del installations[line_req.name]
yield str(installations[canonicalize_name(
line_req.name)]).rstrip()
del installations[canonicalize_name(line_req.name)]
req_files[line_req.name].append(req_file_path)

# Warn about requirements that were included multiple times (in a
Expand Down Expand Up @@ -237,7 +238,7 @@ def get_requirement_info(dist):
class FrozenRequirement(object):
def __init__(self, name, req, editable, comments=()):
# type: (str, Union[str, Requirement], bool, Iterable[str]) -> None
self.name = name
self.name = canonicalize_name(name)
self.req = req
self.editable = editable
self.comments = comments
Expand Down

0 comments on commit f38b729

Please sign in to comment.