Skip to content

Commit

Permalink
Use metadata['name'] to get requirement name
Browse files Browse the repository at this point in the history
Co-authored-by: Tzu-ping Chung <[email protected]>
  • Loading branch information
sbidoul and uranusjr committed May 30, 2022
1 parent 63071d4 commit 7cdc1aa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/pip/_internal/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,14 +354,15 @@ def run(self, options: Values, args: List[str]) -> int:
)

if options.dry_run:
items = [
f"{item.name}-{item.metadata['version']}"
for item in sorted(
requirement_set.all_requirements, key=lambda x: str(x.name)
would_install_items = sorted(
(r.metadata["name"], r.metadata["version"])
for r in requirement_set.all_requirements
)
if would_install_items:
write_output(
"Would install %s",
" ".join("-".join(item) for item in would_install_items),
)
]
if items:
write_output("Would install %s", " ".join(items))
return SUCCESS

try:
Expand Down

0 comments on commit 7cdc1aa

Please sign in to comment.