Skip to content

Commit 8da1bdc

Browse files
ensure PEP 691 json parsing also supports PEP 658 dist-info-metadata
1 parent 266c5cd commit 8da1bdc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/pip/_internal/models/link.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,12 @@ def from_json(
246246
if file_url is None:
247247
return None
248248

249+
url = _ensure_quoted_url(urllib.parse.urljoin(page_url, file_url))
250+
pyrequire = file_data.get("requires-python")
249251
yanked_reason = file_data.get("yanked")
252+
dist_info_metadata = file_data.get("dist-info-metadata")
253+
hashes = file_data.get("hashes", {})
254+
250255
# The Link.yanked_reason expects an empty string instead of a boolean.
251256
if yanked_reason and not isinstance(yanked_reason, str):
252257
yanked_reason = ""
@@ -255,11 +260,12 @@ def from_json(
255260
yanked_reason = None
256261

257262
return cls(
258-
_ensure_quoted_url(urllib.parse.urljoin(page_url, file_url)),
263+
url,
259264
comes_from=page_url,
260-
requires_python=file_data.get("requires-python"),
265+
requires_python=pyrequire,
261266
yanked_reason=yanked_reason,
262-
hashes=file_data.get("hashes", {}),
267+
hashes=hashes,
268+
dist_info_metadata=dist_info_metadata,
263269
)
264270

265271
@classmethod

0 commit comments

Comments
 (0)