Skip to content

Commit ebcefbe

Browse files
sbidouluranusjr
andauthored
Use metadata['name'] to get requirement name
Co-authored-by: Tzu-ping Chung <[email protected]>
1 parent 1d41b1e commit ebcefbe

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/pip/_internal/commands/install.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,15 @@ def run(self, options: Values, args: List[str]) -> int:
353353
)
354354

355355
if options.dry_run:
356-
items = [
357-
f"{item.name}-{item.metadata['version']}"
358-
for item in sorted(
359-
requirement_set.all_requirements, key=lambda x: str(x.name)
360-
)
361-
]
356+
items = sorted(
357+
r.metadata['name'], r.metadata['version']
358+
for r in requirement_set.all_requirements
359+
)
362360
if items:
363-
write_output("Would install %s", " ".join(items))
361+
write_output(
362+
"Would install %s",
363+
" ".join("-".join(item) for item in items),
364+
)
364365
return SUCCESS
365366

366367
try:

0 commit comments

Comments
 (0)