Skip to content

Commit

Permalink
chooser: improve link skip logging
Browse files Browse the repository at this point in the history
  • Loading branch information
abn committed Apr 28, 2022
1 parent 1b77dcf commit b6d4b0a
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/poetry/installation/chooser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import logging
import re

from typing import TYPE_CHECKING
Expand All @@ -17,6 +18,9 @@
from poetry.utils.env import Env


logger = logging.getLogger(__name__)


class InvalidWheelName(Exception):
pass

Expand Down Expand Up @@ -66,9 +70,15 @@ def choose_for(self, package: Package) -> Link:
if link.is_wheel and not Wheel(link.filename).is_supported_by_environment(
self._env
):
logger.debug(
"Skipping wheel %s as this is not supported by the current"
" environment",
link.filename,
)
continue

if link.ext in {".egg", ".exe", ".msi", ".rpm", ".srpm"}:
logger.debug("Skipping unsupported distribution %s", link.filename)
continue

links.append(link)
Expand All @@ -78,8 +88,6 @@ def choose_for(self, package: Package) -> Link:

# Get the best link
chosen = max(links, key=lambda link: self._sort_key(package, link))
if not chosen:
raise RuntimeError(f"Unable to find installation candidates for {package}")

return chosen

Expand All @@ -105,6 +113,11 @@ def _get_links(self, package: Package) -> list[Link]:

h = link.hash_name + ":" + link.hash
if h not in hashes:
logger.debug(
"Skipping %s as %s checksum does not match expected value",
link.filename,
link.hash_name,
)
continue

selected_links.append(link)
Expand Down

0 comments on commit b6d4b0a

Please sign in to comment.