From a6bcdf0c3682d6d588200f9e03806ddd47810d92 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Mon, 7 Aug 2023 09:40:43 +0800 Subject: [PATCH] fix: Link is not defined if not TYPE_CHECKING but it's used Fixes #2151 Signed-off-by: Frost Ming --- src/pdm/models/candidates.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pdm/models/candidates.py b/src/pdm/models/candidates.py index e6df6f6e82..f5eb3818ac 100644 --- a/src/pdm/models/candidates.py +++ b/src/pdm/models/candidates.py @@ -85,6 +85,8 @@ def _find_best_match_link( # In this case, the requirement must be pinned, so no need to pass allow_prereleases # If links are not empty, find the best match from the links, otherwise find from # the package sources. + from unearth import Link + links = [Link(f["url"]) for f in files if "url" in f] hashes = convert_hashes(files)