From b6d4b0adafb45204aadace143f73a789c1c0e33e Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Thu, 28 Apr 2022 22:55:37 +0200 Subject: [PATCH] chooser: improve link skip logging --- src/poetry/installation/chooser.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/poetry/installation/chooser.py b/src/poetry/installation/chooser.py index 424aaefe7bb..e51610f455e 100644 --- a/src/poetry/installation/chooser.py +++ b/src/poetry/installation/chooser.py @@ -1,5 +1,6 @@ from __future__ import annotations +import logging import re from typing import TYPE_CHECKING @@ -17,6 +18,9 @@ from poetry.utils.env import Env +logger = logging.getLogger(__name__) + + class InvalidWheelName(Exception): pass @@ -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) @@ -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 @@ -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)