Skip to content

Commit

Permalink
Merge pull request #580 from linw1995/fix/pdm_show_specific_package_w…
Browse files Browse the repository at this point in the history
…ith_werid_output

Fix pdm show specific package with werid output
  • Loading branch information
frostming authored Aug 5, 2021
2 parents 29b6e62 + 8967ecd commit abd372c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions news/580.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix pdm show weird package info.
14 changes: 9 additions & 5 deletions pdm/models/project_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def __init__(self, metadata: Distribution | Metadata) -> None:

def _parse(self, data: Distribution) -> dict[str, Any]:
metadata = data.metadata
keywords = metadata.get("Keywords", "").replace(",", ", ")
platform = metadata.get("Platform", "").replace(",", ", ")
project_urls = {
k.strip(): v.strip()
for k, v in (row.split(",") for row in metadata.get_all("Project-URL", []))
}
return {
"name": metadata["Name"],
"version": metadata["Version"],
Expand All @@ -32,12 +38,10 @@ def _parse(self, data: Distribution) -> dict[str, Any]:
"email": metadata.get("Author-email", ""),
"license": metadata.get("License", ""),
"requires-python": metadata.get("Requires-Python", ""),
"platform": ", ".join(metadata.get("Platform", [])),
"keywords": ", ".join(metadata.get("Keywords", [])),
"platform": platform,
"keywords": keywords,
"homepage": metadata.get("Home-page", ""),
"project-urls": [
": ".join(parts) for parts in metadata.get("Project-URL", [])
],
"project-urls": [": ".join(parts) for parts in project_urls.items()],
}

def _parse_self(self, metadata: Metadata) -> dict[str, Any]:
Expand Down

0 comments on commit abd372c

Please sign in to comment.