Skip to content

Commit

Permalink
fix: only consider package links for sdist and bdist_wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
finswimmer authored and neersighted committed Jun 5, 2022
1 parent 865aa94 commit e6b66aa
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/poetry/repositories/pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

logger = logging.getLogger(__name__)


if TYPE_CHECKING:
from poetry.core.packages.dependency import Dependency

SUPPORTED_PACKAGE_TYPES = {"sdist", "bdist_wheel"}


class PyPiRepository(HTTPRepository):
def __init__(
Expand Down Expand Up @@ -171,8 +172,9 @@ def find_links_for_package(self, package: Package) -> list[Link]:

links = []
for url in json_data["urls"]:
h = f"sha256={url['digests']['sha256']}"
links.append(Link(url["url"] + "#" + h))
if url["packagetype"] in SUPPORTED_PACKAGE_TYPES:
h = f"sha256={url['digests']['sha256']}"
links.append(Link(url["url"] + "#" + h))

return links

Expand Down Expand Up @@ -206,12 +208,13 @@ def _get_release_info(
version_info = []

for file_info in version_info:
data.files.append(
{
"file": file_info["filename"],
"hash": "sha256:" + file_info["digests"]["sha256"],
}
)
if file_info["packagetype"] in SUPPORTED_PACKAGE_TYPES:
data.files.append(
{
"file": file_info["filename"],
"hash": "sha256:" + file_info["digests"]["sha256"],
}
)

if self._fallback and data.requires_dist is None:
self._log("No dependencies found, downloading archives", level="debug")
Expand All @@ -224,7 +227,7 @@ def _get_release_info(
for url in json_data["urls"]:
# Only get sdist and wheels if they exist
dist_type = url["packagetype"]
if dist_type not in ["sdist", "bdist_wheel"]:
if dist_type not in SUPPORTED_PACKAGE_TYPES:
continue

urls[dist_type].append(url["url"])
Expand Down

0 comments on commit e6b66aa

Please sign in to comment.