From 0a52fd0e81001b0263d7b954353b2ffaf155de48 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 17 Oct 2023 23:07:31 -0500 Subject: [PATCH] Update utils.py --- conda_build/utils.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/conda_build/utils.py b/conda_build/utils.py index 06a5c79c6d..6cafa8f15a 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -1,5 +1,7 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import contextlib import fnmatch import hashlib @@ -68,6 +70,9 @@ from conda.api import PackageCacheData # noqa from conda.base.constants import KNOWN_SUBDIRS +from conda.core.prefix_data import PrefixData +from conda.models.dist import Dist +from conda.models.records import PackageRecord # NOQA because it is not used in this file. from conda_build.conda_interface import rm_rf as _rm_rf # noqa @@ -2153,14 +2158,14 @@ def download_channeldata(channel_url): return data -def linked_data_no_multichannels(prefix): +def linked_data_no_multichannels( + prefix: str | os.PathLike | Path, +) -> dict[Dist, PackageRecord]: """ Return a dictionary of the linked packages in prefix, with correct channels, hopefully. cc @kalefranz. """ - from conda.core.prefix_data import PrefixData - from conda.models.dist import Dist - + prefix = Path(prefix) return { Dist.from_string(prec.fn, channel_override=prec.channel.name): prec for prec in PrefixData(prefix)._prefix_records.values()