Skip to content

Commit

Permalink
use packaging.metadata instead of pkginfo
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Feb 5, 2024
1 parent 25844c5 commit a28cbab
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/poetry/repositories/http_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
from typing import Any
from typing import Iterator

import pkginfo
import requests
import requests.adapters

from packaging.metadata import parse_email
from poetry.core.constraints.version import parse_constraint
from poetry.core.packages.dependency import Dependency
from poetry.core.utils.helpers import temporary_directory
Expand Down Expand Up @@ -160,7 +160,6 @@ def _get_info_from_metadata(self, link: Link) -> PackageInfo | None:
try:
assert link.metadata_url is not None
response = self.session.get(link.metadata_url)
distribution = pkginfo.Distribution()
if link.metadata_hashes and (
hash_name := get_highest_priority_hash_type(
set(link.metadata_hashes.keys()), f"{link.filename}.metadata"
Expand All @@ -178,14 +177,8 @@ def _get_info_from_metadata(self, link: Link) -> PackageInfo | None:
)
return None

distribution.parse(response.content)
return PackageInfo(
name=distribution.name,
version=distribution.version,
summary=distribution.summary,
requires_dist=list(distribution.requires_dist),
requires_python=distribution.requires_python,
)
metadata, _ = parse_email(response.content)
return PackageInfo.from_metadata(metadata)

except requests.HTTPError:
self._log(
Expand Down

0 comments on commit a28cbab

Please sign in to comment.