From be7663c47da0aa3e3a100b0f2cfae429bf1191ba Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Mon, 2 Oct 2023 16:13:12 -0500 Subject: [PATCH] Fixes --- conda_build/conda_interface.py | 15 +++++++-------- conda_build/metadata.py | 16 ++++++++++------ conda_build/utils.py | 8 ++++---- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py index 92d5ba0678..25ecc9cef9 100644 --- a/conda_build/conda_interface.py +++ b/conda_build/conda_interface.py @@ -11,9 +11,8 @@ from conda.auxlib.packaging import ( # noqa: F401 _get_version_from_git_tag as get_version_from_git_tag, ) -from conda.base.context import context, determine_target_prefix +from conda.base.context import context, determine_target_prefix, reset_context from conda.base.context import non_x86_machines as non_x86_linux_machines # noqa: F401 -from conda.base.context import reset_context from conda.core.package_cache import ProgressiveFetchExtract # noqa: F401 from conda.exceptions import ( # noqa: F401 CondaError, @@ -24,15 +23,12 @@ PaddingError, UnsatisfiableError, ) -from conda.exports import ArgumentParser # noqa: F401 -from conda.exports import CondaSession # noqa: F401 -from conda.exports import EntityEncoder # noqa: F401 -from conda.exports import VersionOrder # noqa: F401 -from conda.exports import _toposort # noqa: F401 -from conda.exports import get_index # noqa: F401 from conda.exports import ( # noqa: F401 + ArgumentParser, # noqa: F401 Channel, Completer, + CondaSession, # noqa: F401 + EntityEncoder, # noqa: F401 FileMode, InstalledPackages, MatchSpec, @@ -43,12 +39,15 @@ TemporaryDirectory, TmpDownload, Unsatisfiable, + VersionOrder, # noqa: F401 + _toposort, # noqa: F401 add_parser_channels, add_parser_prefix, display_actions, download, execute_actions, execute_plan, + get_index, # noqa: F401 handle_proxy_407, hashsum_file, human_bytes, diff --git a/conda_build/metadata.py b/conda_build/metadata.py index 47f3166727..0681bcf90c 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -1752,18 +1752,20 @@ def has_prefix_files(self): def ignore_prefix_files(self): ret = self.get_value("build/ignore_prefix_files", False) - if type(ret) not in (list, bool): + if not isinstance(ret, (list, bool)): raise RuntimeError( "build/ignore_prefix_files should be boolean or a list of paths " "(optionally globs)" ) if sys.platform == "win32": - if type(ret) is list and any("\\" in i for i in ret): + if isinstance(ret, list) and any("\\" in i for i in ret): raise RuntimeError( "build/ignore_prefix_files paths must use / " "as the path delimiter on Windows" ) - return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret + return ( + expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret + ) def always_include_files(self): files = ensure_list(self.get_value("build/always_include_files", [])) @@ -1782,18 +1784,20 @@ def ignore_verify_codes(self): def binary_relocation(self): ret = self.get_value("build/binary_relocation", True) - if type(ret) not in (list, bool): + if not isinstance(ret, (list, bool)): raise RuntimeError( "build/binary_relocation should be boolean or a list of paths " "(optionally globs)" ) if sys.platform == "win32": - if type(ret) is list and any("\\" in i for i in ret): + if isinstance(ret, list) and any("\\" in i for i in ret): raise RuntimeError( "build/binary_relocation paths must use / " "as the path delimiter on Windows" ) - return expand_globs(ret, self.config.host_prefix) if type(ret) is list else ret + return ( + expand_globs(ret, self.config.host_prefix) if isinstance(ret, list) else ret + ) def include_recipe(self): return self.get_value("build/include_recipe", True) diff --git a/conda_build/utils.py b/conda_build/utils.py index a62d6700be..af5678247e 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -73,15 +73,15 @@ from conda_build.exceptions import BuildLockError # noqa from conda_build.os_utils import external # noqa -from .conda_interface import Dist # noqa -from .conda_interface import StringIO # noqa -from .conda_interface import cc_conda_build # noqa -from .conda_interface import context # noqa from .conda_interface import ( # noqa CondaHTTPError, + Dist, # noqa MatchSpec, + StringIO, # noqa TemporaryDirectory, VersionOrder, + cc_conda_build, # noqa + context, # noqa download, get_conda_channel, hashsum_file,