Skip to content

Commit

Permalink
fix: PEP 714: rename the dist-info-metadata field to core-metadata
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Jul 4, 2023
1 parent 4fa6e68 commit 0c00d42
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/unearth/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def parse_html_page(page: IndexPage) -> Iterable[Link]:
url = parse.urljoin(base_url, href)
requires_python = anchor.get("data-requires-python")
yank_reason = anchor.get("data-yanked")
data_dist_info_metadata = anchor.get("data-dist-info-metadata")
metadata_hash = anchor.get(
"data-core-metadata", anchor.get("data-dist-info-metadata")
)
dist_info_metadata: bool | dict[str, str] | None = None
if data_dist_info_metadata:
hash_name, has_hash, hash_value = data_dist_info_metadata.partition("=")
if metadata_hash:
hash_name, has_hash, hash_value = metadata_hash.partition("=")
if has_hash:
dist_info_metadata = {hash_name: hash_value}
else:
Expand All @@ -90,7 +92,7 @@ def parse_json_response(page: IndexPage) -> Iterable[Link]:
requires_python: str | None = file.get("requires-python")
yank_reason: str | None = file.get("yanked") or None
dist_info_metadata: bool | dict[str, str] | None = file.get(
"data-dist-info-metadata"
"core-metadata", file.get("data-dist-info-metadata")
)
hashes: dict[str, str] | None = file.get("hashes")
yield Link(
Expand Down

0 comments on commit 0c00d42

Please sign in to comment.