From 834757ea6f7ceb2345524f529be0056cd87a7989 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 14:00:44 -0600 Subject: [PATCH 01/11] Remove deprecated constants --- conda_build/conda_interface.py | 10 +--------- conda_build/os_utils/liefldd.py | 17 ----------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py index 78eeb03f95..179d4b475f 100644 --- a/conda_build/conda_interface.py +++ b/conda_build/conda_interface.py @@ -76,18 +76,10 @@ ) from conda.models.channel import get_conda_build_local_url # noqa: F401 from conda.models.dist import Dist # noqa: F401 -from conda.models.records import PackageRecord, PrefixRecord +from conda.models.records import PrefixRecord from .deprecations import deprecated -deprecated.constant( - "3.28.0", - "24.1.0", - "IndexRecord", - PackageRecord, - addendum="Use `conda.models.records.PackageRecord` instead.", -) - # TODO: Go to references of all properties below and import them from `context` instead binstar_upload = context.binstar_upload default_python = context.default_python diff --git a/conda_build/os_utils/liefldd.py b/conda_build/os_utils/liefldd.py index 8898f45473..d681c75014 100644 --- a/conda_build/os_utils/liefldd.py +++ b/conda_build/os_utils/liefldd.py @@ -21,7 +21,6 @@ # TODO :: Remove all use of pyldd # Currently we verify the output of each against the other from .pyldd import DLLfile, EXEfile, elffile, machofile -from .pyldd import codefile_type as _codefile_type from .pyldd import inspect_linkages as inspect_linkages_pyldd try: @@ -112,22 +111,6 @@ def codefile_type_liefldd(*args, **kwargs) -> str | None: return codefile.__name__ if codefile else None -deprecated.constant( - "3.28.0", - "24.1.0", - "codefile_type_pyldd", - _codefile_type, - addendum="Use `conda_build.os_utils.pyldd.codefile_class` instead.", -) -deprecated.constant( - "3.28.0", - "24.1.0", - "codefile_type", - _codefile_type, - addendum="Use `conda_build.os_utils.liefldd.codefile_class` instead.", -) - - def _trim_sysroot(sysroot): while sysroot.endswith("/") or sysroot.endswith("\\"): sysroot = sysroot[:-1] From b6eb0e49187105fb71f6edcfa900376e078e3526 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 14:01:20 -0600 Subject: [PATCH 02/11] Remove deprecated arguments --- conda_build/inspect_pkg.py | 1 - conda_build/metadata.py | 2 -- conda_build/post.py | 4 ---- 3 files changed, 7 deletions(-) diff --git a/conda_build/inspect_pkg.py b/conda_build/inspect_pkg.py index bb69707456..888248cde8 100644 --- a/conda_build/inspect_pkg.py +++ b/conda_build/inspect_pkg.py @@ -58,7 +58,6 @@ def dist_files(prefix: str | os.PathLike | Path, dist: Dist) -> set[str]: return set() -@deprecated.argument("3.28.0", "24.1.0", "avoid_canonical_channel_name") def which_package( path: str | os.PathLike | Path, prefix: str | os.PathLike | Path, diff --git a/conda_build/metadata.py b/conda_build/metadata.py index 906ce0b628..e02d09de23 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -20,7 +20,6 @@ from . import exceptions, utils, variants from .conda_interface import MatchSpec, envs_dirs, md5_file from .config import Config, get_or_merge_config -from .deprecations import deprecated from .features import feature_list from .license_family import ensure_valid_license_family from .utils import ( @@ -1457,7 +1456,6 @@ def check_field(key, section): check_field(key_or_dict, section) return True - @deprecated.argument("3.28.0", "24.1.0", "fail_ok") def name(self) -> str: name = self.get_value("package/name", "") if not name and self.final: diff --git a/conda_build/post.py b/conda_build/post.py index 558ae50bc9..7a0a901f22 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -713,10 +713,6 @@ def get_run_exports( return () -@deprecated.argument("3.28.0", "24.1.0", "subdir") -@deprecated.argument("3.28.0", "24.1.0", "bldpkgs_dirs") -@deprecated.argument("3.28.0", "24.1.0", "output_folder") -@deprecated.argument("3.28.0", "24.1.0", "channel_urls") def library_nature( prec: PrefixRecord, prefix: str | os.PathLike | Path ) -> Literal[ From 43debde083f37ffd864f6e20f91c3aac44683d62 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 14:12:48 -0600 Subject: [PATCH 03/11] Remove deprecations --- conda_build/conda_interface.py | 75 --------------------------- conda_build/config.py | 73 -------------------------- conda_build/environ.py | 48 ----------------- conda_build/inspect_pkg.py | 20 ------- conda_build/os_utils/ldd.py | 9 ---- conda_build/os_utils/liefldd.py | 16 ------ conda_build/os_utils/pyldd.py | 92 --------------------------------- conda_build/post.py | 72 +------------------------- conda_build/utils.py | 31 ----------- 9 files changed, 2 insertions(+), 434 deletions(-) diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py index 179d4b475f..929384e459 100644 --- a/conda_build/conda_interface.py +++ b/conda_build/conda_interface.py @@ -6,8 +6,6 @@ import os from functools import partial from importlib import import_module # noqa: F401 -from pathlib import Path -from typing import Iterable from conda import __version__ as CONDA_VERSION # noqa: F401 from conda.auxlib.packaging import ( # noqa: F401 @@ -76,9 +74,6 @@ ) from conda.models.channel import get_conda_build_local_url # noqa: F401 from conda.models.dist import Dist # noqa: F401 -from conda.models.records import PrefixRecord - -from .deprecations import deprecated # TODO: Go to references of all properties below and import them from `context` instead binstar_upload = context.binstar_upload @@ -101,76 +96,6 @@ os.environ["CONDA_ALLOW_SOFTLINKS"] = "false" reset_context() - -class CrossPlatformStLink: - def __call__(self, path: str | os.PathLike) -> int: - return self.st_nlink(path) - - @staticmethod - @deprecated("3.24.0", "24.1.0", addendum="Use `os.stat().st_nlink` instead.") - def st_nlink(path: str | os.PathLike) -> int: - return os.stat(path).st_nlink - - -@deprecated("3.28.0", "24.1.0") -class SignatureError(Exception): - # TODO: What is this? 🤔 - pass - - -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda_build.inspect_pkg.which_package` instead.", -) -def which_package(path: str | os.PathLike | Path) -> Iterable[PrefixRecord]: - from .inspect_pkg import which_package - - return which_package(path, which_prefix(path)) - - -@deprecated("3.28.0", "24.1.0") -def which_prefix(path: str | os.PathLike | Path) -> Path: - """ - Given the path (to a (presumably) conda installed file) return the - environment prefix in which the file in located - """ - from conda.gateways.disk.test import is_conda_environment - - prefix = Path(path) - for _ in range(20): - if is_conda_environment(prefix): - return prefix - elif prefix == (parent := prefix.parent): - # we cannot chop off any more directories, so we didn't find it - break - else: - prefix = parent - - raise RuntimeError("could not determine conda prefix from: %s" % path) - - -@deprecated("3.28.0", "24.1.0") -def get_installed_version(prefix, pkgs): - """ - Primarily used by conda-forge, but may be useful in general for checking when - a package needs to be updated - """ - from .utils import ensure_list - - pkgs = ensure_list(pkgs) - linked_pkgs = linked(prefix) - versions = {} - for pkg in pkgs: - vers_inst = [ - dist.split("::", 1)[-1].rsplit("-", 2)[1] - for dist in linked_pkgs - if dist.split("::", 1)[-1].rsplit("-", 2)[0] == pkg - ] - versions[pkg] = vers_inst[0] if len(vers_inst) == 1 else None - return versions - - # When deactivating envs (e.g. switching from root to build/test) this env var is used, # except the PR that removed this has been reverted (for now) and Windows doesn't need it. env_path_backup_var_exists = os.environ.get("CONDA_PATH_BACKUP", None) diff --git a/conda_build/config.py b/conda_build/config.py index 89c158e52d..a631a69593 100644 --- a/conda_build/config.py +++ b/conda_build/config.py @@ -24,7 +24,6 @@ subdir, url_path, ) -from .deprecations import deprecated from .utils import ( get_build_folders, get_conda_operation_locks, @@ -64,23 +63,6 @@ def set_invocation_time(): zstd_compression_level_default = 19 -@deprecated("3.25.0", "24.1.0") -def python2_fs_encode(strin): - return strin - - -@deprecated( - "3.25.0", - "24.1.0", - addendum=( - "Use `pathlib.Path.mkdir(exist_ok=True)` or `os.makedirs(exist_ok=True)` " - "instead." - ), -) -def _ensure_dir(path: os.PathLike): - os.makedirs(path, exist_ok=True) - - # we need this to be accessible to the CLI, so it needs to be more static. DEFAULT_PREFIX_LENGTH = 255 @@ -499,61 +481,6 @@ def build_folder(self): It has the environments and work directories.""" return os.path.join(self.croot, self.build_id) - # back compat for conda-build-all - expects CONDA_* vars to be attributes of the config object - @property - @deprecated("3.0.28", "24.1.0") - def CONDA_LUA(self): - return self.variant.get("lua", get_default_variant(self)["lua"]) - - @CONDA_LUA.setter - @deprecated("3.0.28", "24.1.0") - def CONDA_LUA(self, value): - self.variant["lua"] = value - - @property - @deprecated("3.0.28", "24.1.0") - def CONDA_PY(self): - value = self.variant.get("python", get_default_variant(self)["python"]) - return int("".join(value.split("."))) - - @CONDA_PY.setter - @deprecated("3.0.28", "24.1.0") - def CONDA_PY(self, value): - value = str(value) - self.variant["python"] = ".".join((value[0], value[1:])) - - @property - @deprecated("3.0.28", "24.1.0") - def CONDA_NPY(self): - value = self.variant.get("numpy", get_default_variant(self)["numpy"]) - return int("".join(value.split("."))) - - @CONDA_NPY.setter - @deprecated("3.0.28", "24.1.0") - def CONDA_NPY(self, value): - value = str(value) - self.variant["numpy"] = ".".join((value[0], value[1:])) - - @property - @deprecated("3.0.28", "24.1.0") - def CONDA_PERL(self): - return self.variant.get("perl", get_default_variant(self)["perl"]) - - @CONDA_PERL.setter - @deprecated("3.0.28", "24.1.0") - def CONDA_PERL(self, value): - self.variant["perl"] = value - - @property - @deprecated("3.0.28", "24.1.0") - def CONDA_R(self): - return self.variant.get("r_base", get_default_variant(self)["r_base"]) - - @CONDA_R.setter - @deprecated("3.0.28", "24.1.0") - def CONDA_R(self, value): - self.variant["r_base"] = value - def _get_python(self, prefix, platform): if platform.startswith("win") or (platform == "noarch" and on_win): if os.path.isfile(os.path.join(prefix, "python_d.exe")): diff --git a/conda_build/environ.py b/conda_build/environ.py index 319b4e7bf4..52f5e835ed 100644 --- a/conda_build/environ.py +++ b/conda_build/environ.py @@ -26,15 +26,12 @@ create_default_packages, display_actions, execute_actions, - execute_plan, get_version_from_git_tag, install_actions, - package_cache, pkgs_dirs, reset_context, root_dir, ) -from .deprecations import deprecated from .exceptions import BuildLockError, DependencyNeedsBuildingError from .features import feature_list from .index import get_build_index @@ -1219,51 +1216,6 @@ def remove_existing_packages(dirs, fns, config): utils.rm_rf(entry) -@deprecated("3.28.0", "24.1.0") -def clean_pkg_cache(dist, config): - locks = [] - - conda_log_level = logging.WARN - if config.debug: - conda_log_level = logging.DEBUG - - with utils.LoggingContext(conda_log_level): - locks = get_pkg_dirs_locks([config.bldpkgs_dir] + pkgs_dirs, config) - with utils.try_acquire_locks(locks, timeout=config.timeout): - rmplan = [ - f"RM_EXTRACTED {dist} local::{dist}", - f"RM_FETCHED {dist} local::{dist}", - ] - execute_plan(rmplan) - - # Conda does not seem to do a complete cleanup sometimes. This is supplemental. - # Conda's cleanup is still necessary - it keeps track of its own in-memory - # list of downloaded things. - for folder in pkgs_dirs: - if ( - os.path.exists(os.path.join(folder, dist)) - or os.path.exists(os.path.join(folder, dist + ".tar.bz2")) - or any( - pkg_id in package_cache() for pkg_id in [dist, "local::" + dist] - ) - ): - log = utils.get_logger(__name__) - log.debug( - "Conda caching error: %s package remains in cache after removal", - dist, - ) - log.debug("manually removing to compensate") - cache = package_cache() - keys = [key for key in cache.keys() if dist in key] - for pkg_id in keys: - if pkg_id in cache: - del cache[pkg_id] - - # Note that this call acquires the relevant locks, so this must be called - # outside the lock context above. - remove_existing_packages(pkgs_dirs, [dist], config) - - def get_pinned_deps(m, section): with TemporaryDirectory(prefix="_") as tmpdir: actions = get_install_actions( diff --git a/conda_build/inspect_pkg.py b/conda_build/inspect_pkg.py index 888248cde8..3f3fba7545 100644 --- a/conda_build/inspect_pkg.py +++ b/conda_build/inspect_pkg.py @@ -6,7 +6,6 @@ import os import sys from collections import defaultdict -from functools import lru_cache from itertools import groupby from operator import itemgetter from os.path import abspath, basename, dirname, exists, join, normcase @@ -17,13 +16,10 @@ from conda.api import Solver from conda.core.index import get_index from conda.core.prefix_data import PrefixData -from conda.models.dist import Dist from conda.models.records import PrefixRecord -from conda.resolve import MatchSpec from . import conda_interface from .conda_interface import ( - linked_data, specs_from_args, ) from .deprecations import deprecated @@ -47,17 +43,6 @@ log = get_logger(__name__) -@deprecated("3.28.0", "24.1.0") -@lru_cache(maxsize=None) -def dist_files(prefix: str | os.PathLike | Path, dist: Dist) -> set[str]: - if (prec := PrefixData(str(prefix)).get(dist.name, None)) is None: - return set() - elif MatchSpec(dist).match(prec): - return set(prec["files"]) - else: - return set() - - def which_package( path: str | os.PathLike | Path, prefix: str | os.PathLike | Path, @@ -223,11 +208,6 @@ def test_installable(channel: str = "defaults") -> bool: return success -@deprecated("3.28.0", "24.1.0") -def _installed(prefix: str | os.PathLike | Path) -> dict[str, Dist]: - return {dist.name: dist for dist in linked_data(str(prefix))} - - def _underlined_text(text): return str(text) + "\n" + "-" * len(str(text)) + "\n\n" diff --git a/conda_build/os_utils/ldd.py b/conda_build/os_utils/ldd.py index 70267d08f4..3ab78bc7fd 100644 --- a/conda_build/os_utils/ldd.py +++ b/conda_build/os_utils/ldd.py @@ -13,7 +13,6 @@ from conda.models.records import PrefixRecord from ..conda_interface import untracked -from ..deprecations import deprecated from ..utils import on_linux, on_mac from .macho import otool from .pyldd import codefile_class, inspect_linkages, machofile @@ -108,14 +107,6 @@ def _get_linkages( return linkages -@deprecated("3.28.0", "24.1.0") -@lru_cache(maxsize=None) -def get_package_files( - prec: PrefixRecord, prefix: str | os.PathLike | Path -) -> list[str]: - return prec["files"] - - @lru_cache(maxsize=None) def get_package_obj_files( prec: PrefixRecord, prefix: str | os.PathLike | Path diff --git a/conda_build/os_utils/liefldd.py b/conda_build/os_utils/liefldd.py index d681c75014..c44a03f864 100644 --- a/conda_build/os_utils/liefldd.py +++ b/conda_build/os_utils/liefldd.py @@ -13,7 +13,6 @@ from pathlib import Path from subprocess import PIPE, Popen -from ..deprecations import deprecated from ..utils import on_mac, on_win, rec_glob from .external import find_executable @@ -32,11 +31,6 @@ have_lief = False -@deprecated("3.28.0", "24.1.0", addendum="Use `isinstance(value, str)` instead.") -def is_string(s): - return isinstance(s, str) - - # Some functions can operate on either file names # or an already loaded binary. Generally speaking # these are to be avoided, or if not avoided they @@ -101,16 +95,6 @@ def codefile_class( from .pyldd import codefile_class -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda_build.os_utils.liefldd.codefile_class` instead.", -) -def codefile_type_liefldd(*args, **kwargs) -> str | None: - codefile = codefile_class(*args, **kwargs) - return codefile.__name__ if codefile else None - - def _trim_sysroot(sysroot): while sysroot.endswith("/") or sysroot.endswith("\\"): sysroot = sysroot[:-1] diff --git a/conda_build/os_utils/pyldd.py b/conda_build/os_utils/pyldd.py index 7f1eb81a8b..a3f0d609d0 100644 --- a/conda_build/os_utils/pyldd.py +++ b/conda_build/os_utils/pyldd.py @@ -11,7 +11,6 @@ import sys from pathlib import Path -from ..deprecations import deprecated from ..utils import ensure_list, get_logger, on_linux, on_mac, on_win logging.basicConfig(level=logging.INFO) @@ -364,21 +363,6 @@ def do_file(file, lc_operation, off_sz, arch, results, *args): results.append(do_macho(file, 64, LITTLE_ENDIAN, lc_operation, *args)) -@deprecated("3.28.0", "24.1.0") -def mach_o_change(path, arch, what, value): - """ - Replace a given name (what) in any LC_LOAD_DYLIB command found in - the given binary with a new name (value), provided it's shorter. - """ - - assert len(what) >= len(value) - - results = [] - with open(path, "r+b") as f: - do_file(f, replace_lc_load_dylib, offset_size(), arch, results, what, value) - return results - - def mach_o_find_dylibs(ofile, arch, regex=".*"): """ Finds the executable's view of where any dylibs live @@ -1063,28 +1047,6 @@ def _get_magic_bit(path: Path) -> bytes: return None -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda_build.os_utils.pyldd.codefile_class` instead.", -) -def is_codefile(path: str | os.PathLike | Path, skip_symlinks: bool = True) -> bool: - return bool(codefile_class(path, skip_symlinks=skip_symlinks)) - - -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda_build.os_utils.pyldd.codefile_class` instead.", -) -def codefile_type( - path: str | os.PathLike | Path, - skip_symlinks: bool = True, -) -> str | None: - codefile = codefile_class(path, skip_symlinks=skip_symlinks) - return codefile.__name__ if codefile else None - - def _trim_sysroot(sysroot): if sysroot: while sysroot.endswith("/") or sysroot.endswith("\\"): @@ -1135,48 +1097,6 @@ def _inspect_linkages_this(filename, sysroot="", arch="native"): return cf.uniqueness_key(), orig_names, resolved_names -@deprecated("3.28.0", "24.1.0") -def inspect_rpaths( - filename, resolve_dirnames=True, use_os_varnames=True, sysroot="", arch="native" -): - if not os.path.exists(filename): - return [], [] - sysroot = _trim_sysroot(sysroot) - arch = _get_arch_if_native(arch) - with open(filename, "rb") as f: - # TODO :: Problems here: - # TODO :: 1. macOS can modify RPATH for children in each .so - # TODO :: 2. Linux can identify the program interpreter which can change the initial RPATHs - # TODO :: Should '/lib', '/usr/lib' not include (or be?!) `sysroot`(s) instead? - cf = codefile(f, arch, ["/lib", "/usr/lib"]) - if resolve_dirnames: - return [ - _get_resolved_location( - cf, - rpath, - os.path.dirname(filename), - os.path.dirname(filename), - sysroot, - )[0] - for rpath in cf.rpaths_nontransitive - ] - else: - if use_os_varnames: - return [cf.to_os_varnames(rpath) for rpath in cf.rpaths_nontransitive] - else: - return cf.rpaths_nontransitive - - -@deprecated("3.28.0", "24.1.0") -def get_runpaths(filename, arch="native"): - if not os.path.exists(filename): - return [] - arch = _get_arch_if_native(arch) - with open(filename, "rb") as f: - cf = codefile(f, arch, ["/lib", "/usr/lib"]) - return cf.get_runpaths() - - # TODO :: Consider returning a tree structure or a dict when recurse is True? def inspect_linkages( filename, resolve_filenames=True, recurse=True, sysroot="", arch="native" @@ -1253,18 +1173,6 @@ def otool(*args): return 1 -@deprecated("3.28.0", "24.1.0") -def otool_sys(*args): - import subprocess - - return subprocess.check_output("/usr/bin/otool", args).decode(encoding="ascii") - - -@deprecated("3.28.0", "24.1.0") -def ldd_sys(*args): - return [] - - def ldd(*args): parser = argparse.ArgumentParser(prog="ldd", add_help=False) parser.add_argument("-h", "--help", action="store_true") diff --git a/conda_build/post.py b/conda_build/post.py index 7a0a901f22..5a05eda077 100644 --- a/conda_build/post.py +++ b/conda_build/post.py @@ -32,7 +32,7 @@ ) from pathlib import Path from subprocess import CalledProcessError, call, check_output -from typing import Iterable, Literal +from typing import Literal from conda.core.prefix_data import PrefixData from conda.models.records import PrefixRecord @@ -44,7 +44,6 @@ md5_file, walk_prefix, ) -from .deprecations import deprecated from .exceptions import OverDependingError, OverLinkingError, RunPathError from .inspect_pkg import which_package from .metadata import MetaData @@ -64,7 +63,7 @@ elffile, machofile, ) -from .utils import linked_data_no_multichannels, on_mac, on_win, prefix_files +from .utils import on_mac, on_win, prefix_files filetypes_for_platform = { "win": (DLLfile, EXEfile), @@ -650,26 +649,6 @@ def assert_relative_osx(path, host_prefix, build_prefix): ) -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda_build.post.get_dsos` and `conda_build.post.get_run_exports` instead.", -) -def determine_package_nature( - prec: PrefixRecord, - prefix: str | os.PathLike | Path, - subdir, - bldpkgs_dir, - output_folder, - channel_urls, -) -> tuple[set[str], tuple[str, ...], bool]: - return ( - get_dsos(prec, prefix), - get_run_exports(prec, prefix), - prec.name.startswith("lib"), - ) - - def get_dsos(prec: PrefixRecord, prefix: str | os.PathLike | Path) -> set[str]: return { file @@ -768,36 +747,6 @@ def library_nature( return "non-library" -@deprecated( - "3.28.0", - "24.1.0", - addendum="Query `conda.core.prefix_data.PrefixData` instead.", -) -def dists_from_names(names: Iterable[str], prefix: str | os.PathLike | Path): - names = utils.ensure_list(names) - return [prec for prec in linked_data_no_multichannels(prefix) if prec.name in names] - - -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `conda.models.records.PrefixRecord` instead.", -) -class FakeDist: - def __init__(self, name, version, build_number, build_str, channel, files): - self.name = name - self.quad = [name] - self.version = version - self.build_number = build_number - self.build_string = build_str - self.channel = channel - self.files = files - - def get(self, name): - if name == "files": - return self.files - - # This is really just a small, fixed sysroot and it is rooted at ''. `libcrypto.0.9.8.dylib` should not be in it IMHO. DEFAULT_MAC_WHITELIST = [ "/opt/X11/", @@ -1011,23 +960,6 @@ def _map_file_to_package( return prefix_owners, contains_dsos, contains_static_libs, all_lib_exports -@deprecated( - "3.28.0", "24.1.0", addendum="Use `conda.models.records.PrefixRecord` instead." -) -def _get_fake_pkg_dist(pkg_name, pkg_version, build_str, build_number, channel, files): - return ( - FakeDist( - pkg_name, - str(pkg_version), - build_number, - build_str, - channel, - files, - ), - f"{pkg_name}-{pkg_version}-{build_str}", - ) - - def _print_msg(errors, text, verbose): if text.startswith(" ERROR"): errors.append(text) diff --git a/conda_build/utils.py b/conda_build/utils.py index fc70e9660d..1c303a8b64 100644 --- a/conda_build/utils.py +++ b/conda_build/utils.py @@ -75,7 +75,6 @@ win_path_to_unix, ) from .conda_interface import rm_rf as _rm_rf -from .deprecations import deprecated from .exceptions import BuildLockError on_win = sys.platform == "win32" @@ -763,26 +762,6 @@ def get_conda_operation_locks(locking=True, bldpkgs_dirs=None, timeout=900): return locks -@deprecated( - "3.28.0", - "24.1.0", - addendum="Use `os.path.relpath` or `pathlib.Path.relative_to` instead.", -) -def relative(f, d="lib"): - assert not f.startswith("/"), f - assert not d.startswith("/"), d - d = d.strip("/").split("/") - if d == ["."]: - d = [] - f = dirname(f).split("/") - if f == [""]: - f = [] - while d and f and d[0] == f[0]: - d.pop(0) - f.pop(0) - return "/".join((([".."] * len(f)) if f else ["."]) + d) - - # This is the lowest common denominator of the formats supported by our libarchive/python-libarchive-c # packages across all platforms decompressible_exts = ( @@ -2186,13 +2165,3 @@ def is_conda_pkg(pkg_path: str) -> bool: return path.is_file() and ( any(path.name.endswith(ext) for ext in CONDA_PACKAGE_EXTENSIONS) ) - - -@deprecated("3.28.3", "24.1.0") -def samefile(path1: Path, path2: Path) -> bool: - try: - return path1.samefile(path2) - except (FileNotFoundError, PermissionError): - # FileNotFoundError: path doesn't exist - # PermissionError: don't have permissions to read path - return path1 == path2 From dc0c6faf38e6b152cc3a93a06edced79b18dafe7 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 16:42:10 -0600 Subject: [PATCH 04/11] Remove `conda index` --- conda_build/api.py | 43 ------------ conda_build/cli/main_index.py | 126 ---------------------------------- conda_build/index.py | 62 ----------------- conda_build/plugin.py | 15 ---- recipe/meta.yaml | 1 - 5 files changed, 247 deletions(-) delete mode 100644 conda_build/cli/main_index.py diff --git a/conda_build/api.py b/conda_build/api.py index 8f55488708..8a1298bbe9 100644 --- a/conda_build/api.py +++ b/conda_build/api.py @@ -20,7 +20,6 @@ # make the Config class available in the api namespace from .config import DEFAULT_PREFIX_LENGTH as _prefix_length from .config import Config, get_channel_urls, get_or_merge_config -from .deprecations import deprecated from .utils import ( CONDA_PACKAGE_EXTENSIONS, LoggingContext, @@ -523,48 +522,6 @@ def create_metapackage( ) -@deprecated("3.25.0", "24.1.0", addendum="Use standalone conda-index.") -def update_index( - dir_paths, - config=None, - force=False, - check_md5=False, - remove=False, - channel_name=None, - subdir=None, - threads=None, - patch_generator=None, - verbose=False, - progress=False, - hotfix_source_repo=None, - current_index_versions=None, - **kwargs, -): - import yaml - - from .index import update_index as legacy_update_index - - dir_paths = [os.path.abspath(path) for path in ensure_list(dir_paths)] - - if isinstance(current_index_versions, str): - with open(current_index_versions) as f: - current_index_versions = yaml.safe_load(f) - - for path in dir_paths: - legacy_update_index( - path, - check_md5=check_md5, - channel_name=channel_name, - patch_generator=patch_generator, - threads=threads, - verbose=verbose, - progress=progress, - subdirs=ensure_list(subdir), - current_index_versions=current_index_versions, - index_file=kwargs.get("index_file", None), - ) - - def debug( recipe_or_package_path_or_metadata_tuples, path=None, diff --git a/conda_build/cli/main_index.py b/conda_build/cli/main_index.py deleted file mode 100644 index 79cff86fa6..0000000000 --- a/conda_build/cli/main_index.py +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (C) 2014 Anaconda, Inc -# SPDX-License-Identifier: BSD-3-Clause -import logging -import os -import sys - -from conda_index.index import MAX_THREADS_DEFAULT -from conda_index.utils import DEFAULT_SUBDIRS - -from .. import api -from ..conda_interface import ArgumentParser -from ..deprecations import deprecated - -logging.basicConfig(level=logging.INFO) - - -def parse_args(args): - p = ArgumentParser( - prog="conda index", - description="Update package index metadata files in given directories. " - "Pending deprecated, please use the standalone conda-index project.", - ) - - p.add_argument( - "dir", - help="Directory that contains an index to be updated.", - nargs="*", - default=[os.getcwd()], - ) - - p.add_argument( - "-c", - "--check-md5", - action="store_true", - help="""Use hash values instead of file modification times for determining if a - package's metadata needs to be updated.""", - ) - p.add_argument( - "-n", - "--channel-name", - help="Customize the channel name listed in each channel's index.html.", - ) - p.add_argument( - "-s", - "--subdir", - action="append", - help="Optional. The subdir to index. Can be given multiple times. If not provided, will " - "default to all of %s. If provided, will not create channeldata.json for the channel." - "" % ", ".join(DEFAULT_SUBDIRS), - ) - p.add_argument( - "-t", - "--threads", - default=MAX_THREADS_DEFAULT, - type=int, - ) - p.add_argument( - "-p", - "--patch-generator", - help="Path to Python file that outputs metadata patch instructions from its " - "_patch_repodata function or a .tar.bz2/.conda file which contains a " - "patch_instructions.json file for each subdir", - ) - p.add_argument( - "--hotfix-source-repo", - help="Deprecated, will be removed in a future version of conda build", - ) - p.add_argument("--verbose", help="show extra debugging info", action="store_true") - p.add_argument( - "--no-progress", - help="Hide progress bars", - action="store_false", - dest="progress", - ) - p.add_argument( - "--current-index-versions-file", - "-m", - help=""" - YAML file containing name of package as key, and list of versions as values. The current_index.json - will contain the newest from this series of versions. For example: - - python: - - 2.7 - - 3.6 - - will keep python 2.7.X and 3.6.Y in the current_index.json, instead of only the very latest python version. - """, - ) - p.add_argument( - "-f", - "--file", - help="A file that contains a new line separated list of packages to add to repodata.", - action="store", - ) - - args = p.parse_args(args) - return p, args - - -def execute(args): - _, args = parse_args(args) - - deprecated.topic( - "3.25.0", - "24.1.0", - topic="`conda index` and `conda-index`", - addendum="Use the `conda-index` project instead.", - ) - - api.update_index( - args.dir, - check_md5=args.check_md5, - channel_name=args.channel_name, - threads=args.threads, - subdir=args.subdir, - patch_generator=args.patch_generator, - verbose=args.verbose, - progress=args.progress, - current_index_versions=args.current_index_versions_file, - index_file=args.file, - ) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda index` instead.") -def main(): - return execute(sys.argv[1:]) diff --git a/conda_build/index.py b/conda_build/index.py index 8ac164dccf..9a0004e771 100644 --- a/conda_build/index.py +++ b/conda_build/index.py @@ -61,7 +61,6 @@ human_bytes, url_path, ) -from .deprecations import deprecated from .utils import ( CONDA_PACKAGE_EXTENSION_V1, CONDA_PACKAGE_EXTENSION_V2, @@ -329,67 +328,6 @@ def _delegated_update_index( # Everything below is deprecated to maintain API/feature compatibility. -@deprecated("3.25.0", "24.1.0", addendum="Use standalone conda-index.") -def update_index( - dir_path, - check_md5=False, - channel_name=None, - patch_generator=None, - threads=MAX_THREADS_DEFAULT, - verbose=False, - progress=False, - hotfix_source_repo=None, - subdirs=None, - warn=True, - current_index_versions=None, - debug=False, - index_file=None, -): - """ - If dir_path contains a directory named 'noarch', the path tree therein is treated - as though it's a full channel, with a level of subdirs, each subdir having an update - to repodata.json. The full channel will also have a channeldata.json file. - - If dir_path does not contain a directory named 'noarch', but instead contains at least - one '*.tar.bz2' file, the directory is assumed to be a standard subdir, and only repodata.json - information will be updated. - - """ - base_path, dirname = os.path.split(dir_path) - if dirname in utils.DEFAULT_SUBDIRS: - if warn: - log.warn( - "The update_index function has changed to index all subdirs at once. " - "You're pointing it at a single subdir. " - "Please update your code to point it at the channel root, rather than a subdir." - ) - return update_index( - base_path, - check_md5=check_md5, - channel_name=channel_name, - threads=threads, - verbose=verbose, - progress=progress, - hotfix_source_repo=hotfix_source_repo, - current_index_versions=current_index_versions, - ) - return ChannelIndex( - dir_path, - channel_name, - subdirs=subdirs, - threads=threads, - deep_integrity_check=check_md5, - debug=debug, - ).index( - patch_generator=patch_generator, - verbose=verbose, - progress=progress, - hotfix_source_repo=hotfix_source_repo, - current_index_versions=current_index_versions, - index_file=index_file, - ) - - def _determine_namespace(info): if info.get("namespace"): namespace = info["namespace"] diff --git a/conda_build/plugin.py b/conda_build/plugin.py index 6ca5c34cc1..16ac40bbb1 100644 --- a/conda_build/plugin.py +++ b/conda_build/plugin.py @@ -28,13 +28,6 @@ def develop(*args, **kwargs): execute(*args, **kwargs) -def index(*args, **kwargs): - # deprecated! use conda-index! - from .cli.main_index import execute - - execute(*args, **kwargs) - - def inspect(*args, **kwargs): from .cli.main_inspect import execute @@ -84,14 +77,6 @@ def conda_subcommands(): ), action=develop, ) - yield conda.plugins.CondaSubcommand( - name="index", - summary=( - "Update package index metadata files. Pending deprecation, " - "use https://github.com/conda/conda-index instead." - ), - action=index, - ) yield conda.plugins.CondaSubcommand( name="inspect", summary="Tools for inspecting conda packages.", diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 54c792b9c9..64f2475882 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -13,7 +13,6 @@ build: - conda-convert = conda_build.cli.main_convert:main - conda-debug = conda_build.cli.main_debug:main - conda-develop = conda_build.cli.main_develop:main - - conda-index = conda_build.cli.main_index:main - conda-inspect = conda_build.cli.main_inspect:main - conda-metapackage = conda_build.cli.main_metapackage:main - conda-render = conda_build.cli.main_render:main From 6e232d3b3eb75b29e5457633dc8fbbf7aa8dccef Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 14:37:36 -0600 Subject: [PATCH 05/11] Combine main with execute --- conda_build/cli/main_build.py | 196 +++++++++++++--------------- conda_build/cli/main_convert.py | 46 +++---- conda_build/cli/main_debug.py | 23 ++-- conda_build/cli/main_develop.py | 48 ++++--- conda_build/cli/main_inspect.py | 64 +++++---- conda_build/cli/main_metapackage.py | 51 ++++---- conda_build/cli/main_render.py | 61 ++++----- conda_build/cli/main_skeleton.py | 41 +++--- recipe/meta.yaml | 17 +-- 9 files changed, 254 insertions(+), 293 deletions(-) diff --git a/conda_build/cli/main_build.py b/conda_build/cli/main_build.py index e66ff0e11b..f84024df48 100644 --- a/conda_build/cli/main_build.py +++ b/conda_build/cli/main_build.py @@ -1,35 +1,42 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import argparse import logging import sys import warnings +from argparse import Namespace from glob import glob from itertools import chain from os.path import abspath, expanduser, expandvars from pathlib import Path +from typing import Sequence -import filelock from conda.auxlib.ish import dals from conda.common.io import dashlist from .. import api, build, source, utils -from ..conda_interface import add_parser_channels, binstar_upload, cc_conda_build +from ..conda_interface import ( + ArgumentParser, + add_parser_channels, + binstar_upload, + cc_conda_build, +) from ..config import ( get_channel_urls, get_or_merge_config, zstd_compression_level_default, ) -from ..deprecations import deprecated from ..utils import LoggingContext from .actions import KeyValueAction from .main_render import get_render_parser -def parse_args(args): - p = get_render_parser() - p.prog = "conda build" - p.description = dals( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = get_render_parser() + parser.prog = "conda build" + parser.description = dals( """ Tool for building conda packages. A conda package is a binary tarball containing system-level libraries, Python modules, executable programs, or @@ -38,71 +45,71 @@ def parse_args(args): different sets of packages. """ ) - p.add_argument( + parser.add_argument( "--check", action="store_true", help="Only check (validate) the recipe.", ) - p.add_argument( + parser.add_argument( "--no-anaconda-upload", action="store_false", help="Do not ask to upload the package to anaconda.org.", dest="anaconda_upload", default=binstar_upload, ) - p.add_argument( + parser.add_argument( "--no-binstar-upload", action="store_false", help=argparse.SUPPRESS, dest="anaconda_upload", default=binstar_upload, ) - p.add_argument( + parser.add_argument( "--no-include-recipe", action="store_false", help="Don't include the recipe inside the built package.", dest="include_recipe", default=cc_conda_build.get("include_recipe", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "-s", "--source", action="store_true", help="Only obtain the source (but don't build).", ) - p.add_argument( + parser.add_argument( "-t", "--test", action="store_true", help="Test package (assumes package is already built). RECIPE_DIR argument must be a " "path to built package .tar.bz2 file.", ) - p.add_argument( + parser.add_argument( "--no-test", action="store_true", dest="notest", help="Do not test the package.", ) - p.add_argument( + parser.add_argument( "-b", "--build-only", action="store_true", help="""Only run the build, without any post processing or testing. Implies --no-test and --no-anaconda-upload.""", ) - p.add_argument( + parser.add_argument( "-p", "--post", action="store_true", help="Run the post-build logic. Implies --no-anaconda-upload.", ) - p.add_argument( + parser.add_argument( "-p", "--test-run-post", action="store_true", help="Run the post-build logic during testing.", ) - p.add_argument( + parser.add_argument( "recipe", metavar="RECIPE_PATH", nargs="+", @@ -110,7 +117,7 @@ def parse_args(args): "work and test intermediates. Pass 'purge-all' to also remove " "previously built packages.", ) - p.add_argument( + parser.add_argument( "--skip-existing", action="store_true", help=( @@ -119,56 +126,56 @@ def parse_args(args): ), default=cc_conda_build.get("skip_existing", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--keep-old-work", action="store_true", dest="keep_old_work", help="Do not remove anything from environment, even after successful " "build and test.", ) - p.add_argument( + parser.add_argument( "--dirty", action="store_true", help="Do not remove work directory or _build environment, " "to speed up debugging. Does not apply patches or download source.", ) - p.add_argument( + parser.add_argument( "-q", "--quiet", action="store_true", help="do not display progress bar", default=cc_conda_build.get("quiet", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--debug", action="store_true", help="Show debug output from source checkouts and conda", ) - p.add_argument( + parser.add_argument( "--token", help="Token to pass through to anaconda upload", default=cc_conda_build.get("anaconda_token"), ) - p.add_argument( + parser.add_argument( "--user", help="User/organization to upload packages to on anaconda.org or pypi", default=cc_conda_build.get("user"), ) - p.add_argument( + parser.add_argument( "--label", action="append", dest="labels", default=[], help="Label argument to pass through to anaconda upload", ) - p.add_argument( + parser.add_argument( "--no-force-upload", help="Disable force upload to anaconda.org, preventing overwriting any existing packages", dest="force_upload", default=True, action="store_false", ) - p.add_argument( + parser.add_argument( "--zstd-compression-level", help=( "When building v2 packages, set the compression level used by " @@ -181,7 +188,7 @@ def parse_args(args): "zstd_compression_level", zstd_compression_level_default ), ) - pypi_grp = p.add_argument_group("PyPI upload parameters (twine)") + pypi_grp = parser.add_argument_group("PyPI upload parameters (twine)") pypi_grp.add_argument( "--password", help="password to use when uploading packages to pypi", @@ -213,14 +220,14 @@ def parse_args(args): help="PyPI repository to upload to", default=cc_conda_build.get("pypi_repository", "pypitest"), ) - p.add_argument( + parser.add_argument( "--no-activate", action="store_false", help="do not activate the build and test envs; just prepend to PATH", dest="activate", default=cc_conda_build.get("activate", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--no-build-id", action="store_false", help=( @@ -231,7 +238,7 @@ def parse_args(args): # note: inverted - dest stores positive logic default=cc_conda_build.get("set_build_id", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--build-id-pat", help=( "specify a templated pattern to use as build folder names. Use if having issues with " @@ -240,34 +247,34 @@ def parse_args(args): dest="build_id_pat", default=cc_conda_build.get("build_id_pat", "{n}_{t}"), ) - p.add_argument( + parser.add_argument( "--croot", help=( "Build root folder. Equivalent to CONDA_BLD_PATH, but applies only " "to this call of conda-build." ), ) - p.add_argument( + parser.add_argument( "--verify", action="store_true", help="run verification on recipes or packages when building", default=cc_conda_build.get("verify", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--no-verify", action="store_false", dest="verify", help="do not run verification on recipes or packages when building", default=cc_conda_build.get("verify", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--strict-verify", action="store_true", dest="exit_on_verify_error", help="Exit if any conda-verify check fail, instead of only printing them", default=cc_conda_build.get("exit_on_verify_error", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--output-folder", help=( "folder to dump output package to. Package are moved here if build or test succeeds." @@ -275,7 +282,7 @@ def parse_args(args): ), default=cc_conda_build.get("output_folder"), ) - p.add_argument( + parser.add_argument( "--no-prefix-length-fallback", dest="prefix_length_fallback", action="store_false", @@ -285,7 +292,7 @@ def parse_args(args): ), default=True, ) - p.add_argument( + parser.add_argument( "--prefix-length-fallback", dest="prefix_length_fallback", action="store_true", @@ -297,7 +304,7 @@ def parse_args(args): # had enough time to build long-prefix length packages. default=True, ) - p.add_argument( + parser.add_argument( "--prefix-length", dest="_prefix_length", help=( @@ -312,7 +319,7 @@ def parse_args(args): default=255, type=int, ) - p.add_argument( + parser.add_argument( "--no-locking", dest="locking", default=True, @@ -322,7 +329,7 @@ def parse_args(args): "builds at once on one system with this set." ), ) - p.add_argument( + parser.add_argument( "--no-remove-work-dir", dest="remove_work_dir", default=True, @@ -333,7 +340,7 @@ def parse_args(args): "tests, but ultimately fail on installed systems." ), ) - p.add_argument( + parser.add_argument( "--error-overlinking", dest="error_overlinking", action="store_true", @@ -344,7 +351,7 @@ def parse_args(args): ), default=cc_conda_build.get("error_overlinking", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--no-error-overlinking", dest="error_overlinking", action="store_false", @@ -355,7 +362,7 @@ def parse_args(args): ), default=cc_conda_build.get("error_overlinking", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--error-overdepending", dest="error_overdepending", action="store_true", @@ -366,7 +373,7 @@ def parse_args(args): ), default=cc_conda_build.get("error_overdepending", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--no-error-overdepending", dest="error_overdepending", action="store_false", @@ -377,7 +384,7 @@ def parse_args(args): ), default=cc_conda_build.get("error_overdepending", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--long-test-prefix", action="store_true", help=( @@ -387,7 +394,7 @@ def parse_args(args): ), default=cc_conda_build.get("long_test_prefix", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--no-long-test-prefix", dest="long_test_prefix", action="store_false", @@ -397,7 +404,7 @@ def parse_args(args): ), default=cc_conda_build.get("long_test_prefix", "true").lower() == "true", ) - p.add_argument( + parser.add_argument( "--keep-going", "-k", action="store_true", @@ -406,7 +413,7 @@ def parse_args(args): "failure." ), ) - p.add_argument( + parser.add_argument( "--cache-dir", help=( "Path to store the source files (archives, git clones, etc.) during the build." @@ -417,7 +424,7 @@ def parse_args(args): else cc_conda_build.get("cache_dir") ), ) - p.add_argument( + parser.add_argument( "--no-copy-test-source-files", dest="copy_test_source_files", action="store_false", @@ -430,7 +437,7 @@ def parse_args(args): "in the future." ), ) - p.add_argument( + parser.add_argument( "--merge-build-host", action="store_true", help=( @@ -439,11 +446,11 @@ def parse_args(args): ), default=cc_conda_build.get("merge_build_host", "false").lower() == "true", ) - p.add_argument( + parser.add_argument( "--stats-file", help="File path to save build statistics to. Stats are in JSON format", ) - p.add_argument( + parser.add_argument( "--extra-deps", nargs="+", help=( @@ -452,7 +459,7 @@ def parse_args(args): "meta.yaml or use templates otherwise." ), ) - p.add_argument( + parser.add_argument( "--extra-meta", nargs="*", action=KeyValueAction, @@ -460,7 +467,7 @@ def parse_args(args): "defined as Key=Value with a space separating each pair.", metavar="KEY=VALUE", ) - p.add_argument( + parser.add_argument( "--suppress-variables", action="store_true", help=( @@ -468,12 +475,11 @@ def parse_args(args): ), ) - add_parser_channels(p) - args = p.parse_args(args) - - check_recipe(args.recipe) + add_parser_channels(parser) - return p, args + parsed = parser.parse_args(args) + check_recipe(parsed.recipe) + return parser, parsed def check_recipe(path_list): @@ -516,44 +522,44 @@ def check_action(recipe, config): return api.check(recipe, config=config) -def execute(args): - _parser, args = parse_args(args) - config = get_or_merge_config(None, **args.__dict__) +def execute(args: Sequence[str] | None = None): + _, parsed = parse_args(args) + config = get_or_merge_config(None, **parsed.__dict__) build.check_external() # change globals in build module, see comment there as well - config.channel_urls = get_channel_urls(args.__dict__) + config.channel_urls = get_channel_urls(parsed.__dict__) - config.override_channels = args.override_channels - config.verbose = not args.quiet or args.debug + config.override_channels = parsed.override_channels + config.verbose = not parsed.quiet or parsed.debug - if "purge" in args.recipe: + if "purge" in parsed.recipe: build.clean_build(config) return - if "purge-all" in args.recipe: + if "purge-all" in parsed.recipe: build.clean_build(config) config.clean_pkgs() return outputs = None - if args.output: + if parsed.output: config.verbose = False config.quiet = True config.debug = False - outputs = [output_action(recipe, config) for recipe in args.recipe] - elif args.test: + outputs = [output_action(recipe, config) for recipe in parsed.recipe] + elif parsed.test: outputs = [] failed_recipes = [] recipes = chain.from_iterable( glob(abspath(recipe), recursive=True) if "*" in recipe else [recipe] - for recipe in args.recipe + for recipe in parsed.recipe ) for recipe in recipes: try: test_action(recipe, config) except: - if not args.keep_going: + if not parsed.keep_going: raise else: failed_recipes.append(recipe) @@ -564,40 +570,24 @@ def execute(args): sys.exit(len(failed_recipes)) else: print("All tests passed") - elif args.source: - outputs = [source_action(recipe, config) for recipe in args.recipe] - elif args.check: - outputs = [check_action(recipe, config) for recipe in args.recipe] + elif parsed.source: + outputs = [source_action(recipe, config) for recipe in parsed.recipe] + elif parsed.check: + outputs = [check_action(recipe, config) for recipe in parsed.recipe] else: outputs = api.build( - args.recipe, - post=args.post, - test_run_post=args.test_run_post, - build_only=args.build_only, - notest=args.notest, + parsed.recipe, + post=parsed.post, + test_run_post=parsed.test_run_post, + build_only=parsed.build_only, + notest=parsed.notest, already_built=None, config=config, - verify=args.verify, - variants=args.variants, - cache_dir=args.cache_dir, + verify=parsed.verify, + variants=parsed.variants, + cache_dir=parsed.cache_dir, ) - if not args.output and len(utils.get_build_folders(config.croot)) > 0: + if not parsed.output and len(utils.get_build_folders(config.croot)) > 0: build.print_build_intermediate_warning(config) return outputs - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda build` instead.") -def main(): - try: - execute(sys.argv[1:]) - except RuntimeError as e: - print(str(e)) - sys.exit(1) - except filelock.Timeout as e: - print( - f"File lock on {e.lock_file} could not be obtained. You might need to try fewer builds at once." - " Otherwise, run conda clean --lock" - ) - sys.exit(1) - return diff --git a/conda_build/cli/main_convert.py b/conda_build/cli/main_convert.py index 34b748d407..c30f7982ab 100644 --- a/conda_build/cli/main_convert.py +++ b/conda_build/cli/main_convert.py @@ -1,12 +1,14 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import logging -import sys +from argparse import Namespace from os.path import abspath, expanduser +from typing import Iterable from .. import api from ..conda_interface import ArgumentParser -from ..deprecations import deprecated logging.basicConfig(level=logging.INFO) @@ -35,8 +37,8 @@ """ -def parse_args(args): - p = ArgumentParser( +def parse_args(args: Iterable[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = ArgumentParser( prog="conda convert", description=""" Various tools to convert conda packages. Takes a pure Python package build for @@ -46,8 +48,8 @@ def parse_args(args): ) # TODO: Factor this into a subcommand, since it's python package specific - p.add_argument("files", nargs="+", help="Package files to convert.") - p.add_argument( + parser.add_argument("files", nargs="+", help="Package files to convert.") + parser.add_argument( "-p", "--platform", dest="platforms", @@ -71,7 +73,7 @@ def parse_args(args): help="Platform to convert the packages to.", default=None, ) - p.add_argument( + parser.add_argument( "--dependencies", "-d", nargs="*", @@ -79,19 +81,19 @@ def parse_args(args): package. To specify a version restriction for a dependency, wrap the dependency in quotes, like 'package >=2.0'.""", ) - p.add_argument( + parser.add_argument( "--show-imports", action="store_true", default=False, help="Show Python imports for compiled parts of the package.", ) - p.add_argument( + parser.add_argument( "-f", "--force", action="store_true", help="Force convert, even when a package has compiled C extensions.", ) - p.add_argument( + parser.add_argument( "-o", "--output-dir", default=".", @@ -99,36 +101,30 @@ def parse_args(args): organized in platform/ subdirectories, e.g., win-32/package-1.0-py27_0.tar.bz2.""", ) - p.add_argument( + parser.add_argument( "-v", "--verbose", default=False, action="store_true", help="Print verbose output.", ) - p.add_argument( + parser.add_argument( "--dry-run", action="store_true", help="Only display what would have been done.", ) - p.add_argument( + parser.add_argument( "-q", "--quiet", action="store_true", help="Don't print as much output." ) - args = p.parse_args(args) - return p, args + return parser, parser.parse_args(args) -def execute(args): - _, args = parse_args(args) - files = args.files - del args.__dict__["files"] +def execute(args: Iterable[str] | None = None): + _, parsed = parse_args(args) + files = parsed.files + del parsed.__dict__["files"] for f in files: f = abspath(expanduser(f)) - api.convert(f, **args.__dict__) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda convert` instead.") -def main(): - return execute(sys.argv[1:]) + api.convert(f, **parsed.__dict__) diff --git a/conda_build/cli/main_debug.py b/conda_build/cli/main_debug.py index dd29f988ee..b01b8b5e03 100644 --- a/conda_build/cli/main_debug.py +++ b/conda_build/cli/main_debug.py @@ -1,11 +1,13 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import logging import sys from argparse import ArgumentParser +from typing import Sequence from .. import api -from ..deprecations import deprecated from ..utils import on_win from . import validators as valid from .main_render import get_render_parser @@ -86,25 +88,25 @@ def get_parser() -> ArgumentParser: return p -def execute(args): +def execute(args: Sequence[str] | None = None): parser = get_parser() - args = parser.parse_args(args) + parsed = parser.parse_args(args) try: activation_string = api.debug( - args.recipe_or_package_file_path, - verbose=(not args.activate_string_only), - **args.__dict__, + parsed.recipe_or_package_file_path, + verbose=(not parsed.activate_string_only), + **parsed.__dict__, ) - if not args.activate_string_only: + if not parsed.activate_string_only: print("#" * 80) print( "Test environment created for debugging. To enter a debugging environment:\n" ) print(activation_string) - if not args.activate_string_only: + if not parsed.activate_string_only: test_file = "conda_test_runner.bat" if on_win else "conda_test_runner.sh" print( f"To run your tests, you might want to start with running the {test_file} file." @@ -116,8 +118,3 @@ def execute(args): f"Error: conda-debug encountered the following error:\n{e}", file=sys.stderr ) sys.exit(1) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda debug` instead.") -def main(): - return execute(sys.argv[1:]) diff --git a/conda_build/cli/main_develop.py b/conda_build/cli/main_develop.py index 68abbbce00..2c81a4edc1 100644 --- a/conda_build/cli/main_develop.py +++ b/conda_build/cli/main_develop.py @@ -1,19 +1,21 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import logging -import sys +from argparse import Namespace +from typing import Sequence from conda.base.context import context, determine_target_prefix from .. import api from ..conda_interface import ArgumentParser, add_parser_prefix -from ..deprecations import deprecated logging.basicConfig(level=logging.INFO) -def parse_args(args): - p = ArgumentParser( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = ArgumentParser( prog="conda develop", description=""" @@ -23,10 +25,10 @@ def parse_args(args): # TODO: Use setup.py to determine any entry-points to install. ) - p.add_argument( + parser.add_argument( "source", metavar="PATH", nargs="+", help="Path to the source directory." ) - p.add_argument( + parser.add_argument( "-npf", "--no-pth-file", action="store_true", @@ -36,7 +38,7 @@ def parse_args(args): "Do not add source to conda.pth." ), ) - p.add_argument( + parser.add_argument( "-b", "--build_ext", action="store_true", @@ -47,7 +49,7 @@ def parse_args(args): "environment's lib/." ), ) - p.add_argument( + parser.add_argument( "-c", "--clean", action="store_true", @@ -57,7 +59,7 @@ def parse_args(args): "use with build_ext to clean before building." ), ) - p.add_argument( + parser.add_argument( "-u", "--uninstall", action="store_true", @@ -68,26 +70,20 @@ def parse_args(args): ), ) - add_parser_prefix(p) - p.set_defaults(func=execute) + add_parser_prefix(parser) + parser.set_defaults(func=execute) - args = p.parse_args(args) - return p, args + return parser, parser.parse_args(args) -def execute(args): - _, args = parse_args(args) - prefix = determine_target_prefix(context, args) +def execute(args: Sequence[str] | None = None): + _, parsed = parse_args(args) + prefix = determine_target_prefix(context, parsed) api.develop( - args.source, + parsed.source, prefix=prefix, - no_pth_file=args.no_pth_file, - build_ext=args.build_ext, - clean=args.clean, - uninstall=args.uninstall, + no_pth_file=parsed.no_pth_file, + build_ext=parsed.build_ext, + clean=parsed.clean, + uninstall=parsed.uninstall, ) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda develop` instead.") -def main(): - return execute(sys.argv[1:]) diff --git a/conda_build/cli/main_inspect.py b/conda_build/cli/main_inspect.py index 7f9a30c847..58cba771dc 100644 --- a/conda_build/cli/main_inspect.py +++ b/conda_build/cli/main_inspect.py @@ -1,21 +1,24 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import logging import sys +from argparse import Namespace from os.path import expanduser from pprint import pprint +from typing import Sequence from conda.base.context import context, determine_target_prefix from .. import api from ..conda_interface import ArgumentParser, add_parser_prefix -from ..deprecations import deprecated logging.basicConfig(level=logging.INFO) -def parse_args(args): - p = ArgumentParser( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = ArgumentParser( prog="conda inspect", description="Tools for inspecting conda packages.", epilog=""" @@ -23,7 +26,7 @@ def parse_args(args): options available. """, ) - subcommand = p.add_subparsers( + subcommand = parser.add_subparsers( dest="subcommand", ) @@ -177,49 +180,44 @@ def parse_args(args): nargs="*", help="Conda packages to inspect.", ) - args = p.parse_args(args) - return p, args + + return parser, parser.parse_args(args) -def execute(args): - parser, args = parse_args(args) +def execute(args: Sequence[str] | None = None): + parser, parsed = parse_args(args) - if not args.subcommand: + if not parsed.subcommand: parser.print_help() sys.exit(0) - elif args.subcommand == "channels": - print(api.test_installable(args.channel)) - elif args.subcommand == "linkages": + elif parsed.subcommand == "channels": + print(api.test_installable(parsed.channel)) + elif parsed.subcommand == "linkages": print( api.inspect_linkages( - args.packages, - prefix=determine_target_prefix(context, args), - untracked=args.untracked, - all_packages=args.all, - show_files=args.show_files, - groupby=args.groupby, - sysroot=expanduser(args.sysroot), + parsed.packages, + prefix=determine_target_prefix(context, parsed), + untracked=parsed.untracked, + all_packages=parsed.all, + show_files=parsed.show_files, + groupby=parsed.groupby, + sysroot=expanduser(parsed.sysroot), ) ) - elif args.subcommand == "objects": + elif parsed.subcommand == "objects": print( api.inspect_objects( - args.packages, - prefix=determine_target_prefix(context, args), - groupby=args.groupby, + parsed.packages, + prefix=determine_target_prefix(context, parsed), + groupby=parsed.groupby, ) ) - elif args.subcommand == "prefix-lengths": + elif parsed.subcommand == "prefix-lengths": if not api.inspect_prefix_length( - args.packages, min_prefix_length=args.min_prefix_length + parsed.packages, min_prefix_length=parsed.min_prefix_length ): sys.exit(1) - elif args.subcommand == "hash-inputs": - pprint(api.inspect_hash_inputs(args.packages)) + elif parsed.subcommand == "hash-inputs": + pprint(api.inspect_hash_inputs(parsed.packages)) else: - parser.error(f"Unrecognized subcommand: {args.subcommand}.") - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda inspect` instead.") -def main(): - return execute(sys.argv[1:]) + parser.error(f"Unrecognized subcommand: {parsed.subcommand}.") diff --git a/conda_build/cli/main_metapackage.py b/conda_build/cli/main_metapackage.py index 4b7e4df110..b4c610aea8 100644 --- a/conda_build/cli/main_metapackage.py +++ b/conda_build/cli/main_metapackage.py @@ -1,18 +1,20 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import argparse import logging -import sys +from argparse import Namespace +from typing import Sequence from .. import api from ..conda_interface import ArgumentParser, add_parser_channels, binstar_upload -from ..deprecations import deprecated logging.basicConfig(level=logging.INFO) -def parse_args(args): - p = ArgumentParser( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = ArgumentParser( prog="conda metapackage", description=""" Tool for building conda metapackages. A metapackage is a package with no @@ -25,51 +27,51 @@ def parse_args(args): """, ) - p.add_argument( + parser.add_argument( "--no-anaconda-upload", action="store_false", help="Do not ask to upload the package to anaconda.org.", dest="anaconda_upload", default=binstar_upload, ) - p.add_argument( + parser.add_argument( "--no-binstar-upload", action="store_false", help=argparse.SUPPRESS, dest="anaconda_upload", default=binstar_upload, ) - p.add_argument("--token", help="Token to pass through to anaconda upload") - p.add_argument( + parser.add_argument("--token", help="Token to pass through to anaconda upload") + parser.add_argument( "--user", help="User/organization to upload packages to on anaconda.org" ) - p.add_argument( + parser.add_argument( "--label", action="append", dest="labels", default=[], help="Label argument to pass through to anaconda upload", ) - p.add_argument( + parser.add_argument( "name", help="Name of the created package.", ) - p.add_argument( + parser.add_argument( "version", help="Version of the created package.", ) - p.add_argument( + parser.add_argument( "--build-number", type=int, default=0, help="Build number for the package (default is 0).", ) - p.add_argument( + parser.add_argument( "--build-string", default=None, help="Build string for the package (default is automatically generated).", ) - p.add_argument( + parser.add_argument( "--dependencies", "-d", nargs="*", @@ -77,21 +79,21 @@ def parse_args(args): help="""The dependencies of the package. To specify a version restriction for a dependency, wrap the dependency in quotes, like 'package >=2.0'.""", ) - p.add_argument( + parser.add_argument( "--home", help="The homepage for the metapackage.", ) - p.add_argument( + parser.add_argument( "--license", help="The license of the metapackage.", dest="license_name" ) - p.add_argument( + parser.add_argument( "--summary", help="""Summary of the package. Pass this in as a string on the command line, like --summary 'A metapackage for X'. It is recommended to use single quotes if you are not doing variable substitution to avoid interpretation of special characters.""", ) - p.add_argument( + parser.add_argument( "--entry-points", nargs="*", default=(), @@ -101,17 +103,12 @@ def parse_args(args): bsdiff4 that calls bsdiff4.cli.main_bsdiff4(). """, ) - add_parser_channels(p) - args = p.parse_args(args) - return p, args + add_parser_channels(parser) + + return parser, parser.parse_args(args) -def execute(args): +def execute(args: Sequence[str] | None = None): _, args = parse_args(args) channel_urls = args.__dict__.get("channel") or args.__dict__.get("channels") or () api.create_metapackage(channel_urls=channel_urls, **args.__dict__) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda metapackage` instead.") -def main(): - return execute(sys.argv[1:]) diff --git a/conda_build/cli/main_render.py b/conda_build/cli/main_render.py index cdd831021b..155c0e7739 100644 --- a/conda_build/cli/main_render.py +++ b/conda_build/cli/main_render.py @@ -1,9 +1,12 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import argparse import logging -import sys +from argparse import Namespace from pprint import pprint +from typing import Sequence import yaml from yaml.parser import ParserError @@ -11,7 +14,6 @@ from .. import __version__, api from ..conda_interface import ArgumentParser, add_parser_channels, cc_conda_build from ..config import get_channel_urls, get_or_merge_config -from ..deprecations import deprecated from ..utils import LoggingContext from ..variants import get_package_variants, set_language_env_vars @@ -163,70 +165,70 @@ def get_render_parser(): return p -def parse_args(args): - p = get_render_parser() - p.add_argument( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = get_render_parser() + parser.add_argument( "-f", "--file", help="write YAML to file, given as argument here.\ Overwrites existing files.", ) # we do this one separately because we only allow one entry to conda render - p.add_argument( + parser.add_argument( "recipe", metavar="RECIPE_PATH", help="Path to recipe directory.", ) # this is here because we have a different default than build - p.add_argument( + parser.add_argument( "--verbose", action="store_true", help="Enable verbose output from download tools and progress updates", ) - args, _ = p.parse_known_args(args) - return p, args + + return parser, parser.parse_args(args) -def execute(args, print_results=True): - p, args = parse_args(args) +def execute(args: Sequence[str] | None = None, print_results: bool = True): + _, parsed = parse_args(args) - config = get_or_merge_config(None, **args.__dict__) + config = get_or_merge_config(None, **parsed.__dict__) - variants = get_package_variants(args.recipe, config, variants=args.variants) + variants = get_package_variants(parsed.recipe, config, variants=parsed.variants) from ..build import get_all_replacements get_all_replacements(variants) set_language_env_vars(variants) - config.channel_urls = get_channel_urls(args.__dict__) + config.channel_urls = get_channel_urls(parsed.__dict__) - config.override_channels = args.override_channels + config.override_channels = parsed.override_channels - if args.output: + if parsed.output: config.verbose = False config.debug = False metadata_tuples = api.render( - args.recipe, + parsed.recipe, config=config, - no_download_source=args.no_source, - variants=args.variants, + no_download_source=parsed.no_source, + variants=parsed.variants, ) - if args.file and len(metadata_tuples) > 1: + if parsed.file and len(metadata_tuples) > 1: log.warning( "Multiple variants rendered. " - f"Only one will be written to the file you specified ({args.file})." + f"Only one will be written to the file you specified ({parsed.file})." ) if print_results: - if args.output: + if parsed.output: with LoggingContext(logging.CRITICAL + 1): paths = api.get_output_file_paths(metadata_tuples, config=config) print("\n".join(sorted(paths))) - if args.file: + if parsed.file: m = metadata_tuples[-1][0] - api.output_yaml(m, args.file, suppress_outputs=True) + api.output_yaml(m, parsed.file, suppress_outputs=True) else: logging.basicConfig(level=logging.INFO) for m, _, _ in metadata_tuples: @@ -237,15 +239,6 @@ def execute(args, print_results=True): print("----------") print("meta.yaml:") print("----------") - print(api.output_yaml(m, args.file, suppress_outputs=True)) + print(api.output_yaml(m, parsed.file, suppress_outputs=True)) else: return metadata_tuples - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda render` instead.") -def main(): - return execute(sys.argv[1:]) - - -if __name__ == "__main__": - main() diff --git a/conda_build/cli/main_skeleton.py b/conda_build/cli/main_skeleton.py index 219c8d1734..ade4b14d0e 100644 --- a/conda_build/cli/main_skeleton.py +++ b/conda_build/cli/main_skeleton.py @@ -1,22 +1,25 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause +from __future__ import annotations + import importlib import logging import os import pkgutil import sys +from argparse import Namespace +from typing import Sequence from .. import api from ..conda_interface import ArgumentParser from ..config import Config -from ..deprecations import deprecated thisdir = os.path.dirname(os.path.abspath(__file__)) logging.basicConfig(level=logging.INFO) -def parse_args(args): - p = ArgumentParser( +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: + parser = ArgumentParser( prog="conda skeleton", description=""" Generates a boilerplate/skeleton recipe, which you can then edit to create a @@ -28,7 +31,7 @@ def parse_args(args): """, ) - repos = p.add_subparsers(dest="repo") + repos = parser.add_subparsers(dest="repo") skeletons = [ name @@ -40,32 +43,22 @@ def parse_args(args): module = importlib.import_module("conda_build.skeletons." + skeleton) module.add_parser(repos) - args = p.parse_args(args) - return p, args + return parser, parser.parse_args(args) -def execute(args): - parser, args = parse_args(args) - config = Config(**args.__dict__) +def execute(args: Sequence[str] | None = None): + parser, parsed = parse_args(args) + config = Config(**parsed.__dict__) - if not args.repo: + if not parsed.repo: parser.print_help() sys.exit() api.skeletonize( - args.packages, - args.repo, - output_dir=args.output_dir, - recursive=args.recursive, - version=args.version, + parsed.packages, + parsed.repo, + output_dir=parsed.output_dir, + recursive=parsed.recursive, + version=parsed.version, config=config, ) - - -@deprecated("3.26.0", "24.1.0", addendum="Use `conda skeleton` instead.") -def main(): - return execute(sys.argv[1:]) - - -if __name__ == "__main__": - main() diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 64f2475882..9fcf09e836 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -9,14 +9,15 @@ source: build: script: {{ PYTHON }} -m pip install . --no-deps --no-build-isolation -vv entry_points: - - conda-build = conda_build.cli.main_build:main - - conda-convert = conda_build.cli.main_convert:main - - conda-debug = conda_build.cli.main_debug:main - - conda-develop = conda_build.cli.main_develop:main - - conda-inspect = conda_build.cli.main_inspect:main - - conda-metapackage = conda_build.cli.main_metapackage:main - - conda-render = conda_build.cli.main_render:main - - conda-skeleton = conda_build.cli.main_skeleton:main + - conda-build = conda_build.cli.main_build:execute + - conda-convert = conda_build.cli.main_convert:execute + - conda-debug = conda_build.cli.main_debug:execute + - conda-develop = conda_build.cli.main_develop:execute + - conda-index = conda_build.cli.main_index:main + - conda-inspect = conda_build.cli.main_inspect:execute + - conda-metapackage = conda_build.cli.main_metapackage:execute + - conda-render = conda_build.cli.main_render:execute + - conda-skeleton = conda_build.cli.main_skeleton:execute requirements: build: From 7514a72c79c2a8fad8c27b963d721e0818580e47 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 17:04:20 -0600 Subject: [PATCH 06/11] Remove unnecessary tests --- tests/cli/test_main_index.py | 11 ----------- tests/test_api_update_index.py | 12 ------------ tests/test_misc.py | 17 +---------------- 3 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 tests/cli/test_main_index.py delete mode 100644 tests/test_api_update_index.py diff --git a/tests/cli/test_main_index.py b/tests/cli/test_main_index.py deleted file mode 100644 index 75b1926f78..0000000000 --- a/tests/cli/test_main_index.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (C) 2014 Anaconda, Inc -# SPDX-License-Identifier: BSD-3-Clause -import os.path - -from conda_build.cli import main_index - - -def testing_index(testing_workdir): - args = ["."] - main_index.execute(args) - assert os.path.isfile("noarch/repodata.json") diff --git a/tests/test_api_update_index.py b/tests/test_api_update_index.py deleted file mode 100644 index 6573d5533a..0000000000 --- a/tests/test_api_update_index.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (C) 2014 Anaconda, Inc -# SPDX-License-Identifier: BSD-3-Clause -from pathlib import Path - -from conda_build.api import update_index - - -def test_update_index(testing_workdir): - update_index(testing_workdir) - - for name in ("repodata.json", "repodata.json.bz2"): - assert Path(testing_workdir, "noarch", name).is_file() diff --git a/tests/test_misc.py b/tests/test_misc.py index 7a8b56dced..bcdafcb196 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -1,13 +1,12 @@ # Copyright (C) 2014 Anaconda, Inc # SPDX-License-Identifier: BSD-3-Clause import json -import os from pathlib import Path import pytest from conda_build._link import pyc_f -from conda_build.conda_interface import CrossPlatformStLink, EntityEncoder, PathType +from conda_build.conda_interface import EntityEncoder, PathType @pytest.mark.parametrize( @@ -40,17 +39,3 @@ def test_entity_encoder(tmp_path): json_file = json.loads(test_file.read_text()) assert json_file == {"a": "hardlink", "b": 1} - - -def test_crossplatform_st_link(tmp_path): - test_file = tmp_path / "test-file" - test_file_linked = tmp_path / "test-file-linked" - test_file_link = tmp_path / "test-file-link" - - test_file.touch() - test_file_link.touch() - os.link(test_file_link, test_file_linked) - - assert 1 == CrossPlatformStLink.st_nlink(test_file) - assert 2 == CrossPlatformStLink.st_nlink(test_file_link) - assert 2 == CrossPlatformStLink.st_nlink(test_file_linked) From 4944105b1a2ce981f29704cfcb0cc42e1e8236cf Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 17:20:00 -0600 Subject: [PATCH 07/11] Add news --- news/5151-remove-deprecations | 70 +++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 news/5151-remove-deprecations diff --git a/news/5151-remove-deprecations b/news/5151-remove-deprecations new file mode 100644 index 0000000000..6bf3073a23 --- /dev/null +++ b/news/5151-remove-deprecations @@ -0,0 +1,70 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* Remove `conda_build.api.update_index`. (#5151) +* Remove `conda_build.cli.main_build.main`. (#5151) +* Remove `conda_build.cli.main_convert.main`. (#5151) +* Remove `conda_build.cli.main_debug.main`. (#5151) +* Remove `conda_build.cli.main_develop.main`. (#5151) +* Remove `conda_build.cli.main_index`. (#5151) +* Remove `conda_build.cli.main_inspect.main`. (#5151) +* Remove `conda_build.cli.main_metapackage.main`. (#5151) +* Remove `conda_build.cli.main_render.main`. (#5151) +* Remove `conda_build.cli.main_skeleton.main`. (#5151) +* Remove `conda_build.conda_interface.IndexRecord`. (#5151) +* Remove `conda_build.conda_interface.CrossPlatformStLink`. (#5151) +* Remove `conda_build.conda_interface.SignatureError`. (#5151) +* Remove `conda_build.conda_interface.which_package`. (#5151) +* Remove `conda_build.conda_interface.which_prefix`. (#5151) +* Remove `conda_build.conda_interface.get_installed_version`. (#5151) +* Remove `conda_build.config.python2_fs_encode`. (#5151) +* Remove `conda_build.config._ensure_dir`. (#5151) +* Remove `conda_build.config.Config.CONDA_LUA`. (#5151) +* Remove `conda_build.config.Config.CONDA_PY`. (#5151) +* Remove `conda_build.config.Config.CONDA_NPY`. (#5151) +* Remove `conda_build.config.Config.CONDA_PERL`. (#5151) +* Remove `conda_build.config.Config.CONDA_R`. (#5151) +* Remove `conda_build.environ.clean_pkg_cache`. (#5151) +* Remove `conda_build.index.update_index`. (#5151) +* Remove `conda_build.inspect_pkg.dist_files`. (#5151) +* Remove `conda_build.inspect_pkg.which_package(avoid_canonical_channel_name)`. (#5151) +* Remove `conda_build.inspect_pkg._installed`. (#5151) +* Remove `conda_build.metadata.Metadata.name(fail_ok)`. (#5151) +* Remove `conda_build.os_utils.ldd.get_package_files`. (#5151) +* Remove `conda_build.os_utils.liefldd.is_string`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type_liefldd`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type_pyldd`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type`. (#5151) +* Remove `conda_build.os_utils.pyldd.mach_o_change`. (#5151) +* Remove `conda_build.os_utils.pyldd.is_codefile`. (#5151) +* Remove `conda_build.os_utils.pyldd.codefile_type`. (#5151) +* Remove `conda_build.os_utils.pyldd.inspect_rpaths`. (#5151) +* Remove `conda_build.os_utils.pyldd.get_runpaths`. (#5151) +* Remove `conda_build.os_utils.pyldd.otool_sys`. (#5151) +* Remove `conda_build.os_utils.pyldd.ldd_sys`. (#5151) +* Remove `conda_build.plugin.index`. (#5151) +* Remove `conda_build.post.determine_package_nature`. (#5151) +* Remove `conda_build.post.library_nature(subdir)`. (#5151) +* Remove `conda_build.post.library_nature(bldpkgs_dirs)`. (#5151) +* Remove `conda_build.post.library_nature(output_folder)`. (#5151) +* Remove `conda_build.post.library_nature(channel_urls)`. (#5151) +* Remove `conda_build.post.dists_from_names`. (#5151) +* Remove `conda_build.post.FakeDist`. (#5151) +* Remove `conda_build.post._get_fake_pkg_dist`. (#5151) +* Remove `conda_build.utils.relative`. (#5151) +* Remove `conda_build.utils.samefile`. (#5151) + +### Docs + +* + +### Other + +* From 17c3251408c80bbea9ca75de83929e2fd9e06209 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 17:52:07 -0600 Subject: [PATCH 08/11] Cleanup tests --- tests/cli/test_main_debug.py | 6 +-- tests/test_api_build.py | 5 +- tests/test_api_consistency.py | 39 --------------- tests/test_conda_interface.py | 9 ---- tests/test_subpackages.py | 1 - tests/test_utils.py | 91 ----------------------------------- 6 files changed, 6 insertions(+), 145 deletions(-) delete mode 100644 tests/test_conda_interface.py diff --git a/tests/cli/test_main_debug.py b/tests/cli/test_main_debug.py index 22011bedf1..ae4f22441d 100644 --- a/tests/cli/test_main_debug.py +++ b/tests/cli/test_main_debug.py @@ -16,7 +16,7 @@ def test_main_debug_help_message(capsys: CaptureFixture, monkeypatch: MonkeyPatc help_blurb = debug.get_parser().format_help() with pytest.raises(SystemExit): - debug.main() + debug.execute() captured = capsys.readouterr() assert help_blurb in captured.out @@ -28,7 +28,7 @@ def test_main_debug_file_does_not_exist( monkeypatch.setattr(sys, "argv", ["conda-debug", "file-does-not-exist"]) with pytest.raises(SystemExit): - debug.main() + debug.execute() captured = capsys.readouterr() assert valid.CONDA_PKG_OR_RECIPE_ERROR_MESSAGE in captured.err @@ -45,7 +45,7 @@ def test_main_debug_happy_path( monkeypatch.setattr(sys, "argv", ["conda-debug", str(fake)]) with mock.patch("conda_build.api.debug") as mock_debug: - debug.main() + debug.execute() captured = capsys.readouterr() assert captured.err == "" diff --git a/tests/test_api_build.py b/tests/test_api_build.py index 1ac2ca06d2..c9bc2cd31e 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -27,6 +27,7 @@ from binstar_client.errors import NotFound from conda.common.compat import on_linux, on_mac, on_win from conda.exceptions import ClobberError, CondaMultiError +from conda_index.api import update_index from pytest import FixtureRequest, MonkeyPatch from pytest_mock import MockerFixture @@ -533,7 +534,7 @@ def test_skip_existing_url(testing_metadata, testing_workdir, capfd): copy_into(outputs[0], os.path.join(platform, os.path.basename(outputs[0]))) # create the index so conda can find the file - api.update_index(output_dir) + update_index(output_dir) testing_metadata.config.skip_existing = True testing_metadata.config.channel_urls = [url_path(output_dir)] @@ -1467,7 +1468,7 @@ def test_run_constrained_stores_constrains_info(testing_config): @pytest.mark.sanity def test_no_locking(testing_config): recipe = os.path.join(metadata_dir, "source_git_jinja2") - api.update_index(os.path.join(testing_config.croot)) + update_index(os.path.join(testing_config.croot)) api.build(recipe, config=testing_config, locking=False) diff --git a/tests/test_api_consistency.py b/tests/test_api_consistency.py index 502046e5ad..56685f66d1 100644 --- a/tests/test_api_consistency.py +++ b/tests/test_api_consistency.py @@ -2,8 +2,6 @@ # SPDX-License-Identifier: BSD-3-Clause # This file makes sure that our API has not changed. Doing so can not be accidental. Whenever it # happens, we should bump our major build number, because we may have broken someone. - -import inspect import sys from inspect import getfullargspec as getargspec @@ -183,40 +181,3 @@ def test_api_create_metapackage(): "config", ] assert argspec.defaults == ((), None, 0, (), None, None, None, None) - - -def test_api_update_index(): - # getfullargspec() isn't friends with functools.wraps - argspec = inspect.signature(api.update_index) - assert list(argspec.parameters) == [ - "dir_paths", - "config", - "force", - "check_md5", - "remove", - "channel_name", - "subdir", - "threads", - "patch_generator", - "verbose", - "progress", - "hotfix_source_repo", - "current_index_versions", - "kwargs", - ] - assert tuple(parameter.default for parameter in argspec.parameters.values()) == ( - inspect._empty, - None, - False, - False, - False, - None, - None, - None, - None, - False, - False, - None, - None, - inspect._empty, - ) diff --git a/tests/test_conda_interface.py b/tests/test_conda_interface.py deleted file mode 100644 index 1c13d6faf9..0000000000 --- a/tests/test_conda_interface.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (C) 2014 Anaconda, Inc -# SPDX-License-Identifier: BSD-3-Clause -from conda_build import conda_interface as ci - - -def test_get_installed_version(): - versions = ci.get_installed_version(ci.root_dir, "conda") - assert versions.get("conda") - assert ci.VersionOrder(versions.get("conda")) diff --git a/tests/test_subpackages.py b/tests/test_subpackages.py index d89b888758..3937036d14 100644 --- a/tests/test_subpackages.py +++ b/tests/test_subpackages.py @@ -89,7 +89,6 @@ def test_run_exports_in_subpackage(testing_metadata): p1 = testing_metadata.copy() p1.meta["outputs"] = [{"name": "has_run_exports", "run_exports": "bzip2 1.0"}] api.build(p1, config=testing_metadata.config)[0] - # api.update_index(os.path.dirname(output), config=testing_metadata.config) p2 = testing_metadata.copy() p2.meta["requirements"]["host"] = ["has_run_exports"] p2_final = finalize_metadata(p2) diff --git a/tests/test_utils.py b/tests/test_utils.py index 727859501a..d245e65796 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -79,97 +79,6 @@ def test_disallow_in_tree_merge(testing_workdir): utils.merge_tree(testing_workdir, os.path.join(testing_workdir, "subdir")) -def test_relative_default(): - for f, r in [ - ("bin/python", "../lib"), - ("lib/libhdf5.so", "."), - ("lib/python2.6/foobar.so", ".."), - ("lib/python2.6/lib-dynload/zlib.so", "../.."), - ("lib/python2.6/site-packages/pyodbc.so", "../.."), - ("lib/python2.6/site-packages/bsdiff4/core.so", "../../.."), - ("xyz", "./lib"), - ("bin/somedir/cmd", "../../lib"), - ]: - assert utils.relative(f) == r - - -def test_relative_lib(): - for f, r in [ - ("bin/python", "../lib"), - ("lib/libhdf5.so", "."), - ("lib/python2.6/foobar.so", ".."), - ("lib/python2.6/lib-dynload/zlib.so", "../.."), - ("lib/python2.6/site-packages/pyodbc.so", "../.."), - ("lib/python2.6/site-packages/bsdiff3/core.so", "../../.."), - ("xyz", "./lib"), - ("bin/somedir/cmd", "../../lib"), - ("bin/somedir/somedir2/cmd", "../../../lib"), - ]: - assert utils.relative(f, "lib") == r - - -def test_relative_subdir(): - for f, r in [ - ("lib/libhdf5.so", "./sub"), - ("lib/sub/libhdf5.so", "."), - ("bin/python", "../lib/sub"), - ("bin/somedir/cmd", "../../lib/sub"), - ]: - assert utils.relative(f, "lib/sub") == r - - -def test_relative_prefix(): - for f, r in [ - ("xyz", "."), - ("a/xyz", ".."), - ("a/b/xyz", "../.."), - ("a/b/c/xyz", "../../.."), - ("a/b/c/d/xyz", "../../../.."), - ]: - assert utils.relative(f, ".") == r - - -def test_relative_2(): - for f, r in [ - ("a/b/c/d/libhdf5.so", "../.."), - ("a/b/c/libhdf5.so", ".."), - ("a/b/libhdf5.so", "."), - ("a/libhdf5.so", "./b"), - ("x/x/libhdf5.so", "../../a/b"), - ("x/b/libhdf5.so", "../../a/b"), - ("x/libhdf5.so", "../a/b"), - ("libhdf5.so", "./a/b"), - ]: - assert utils.relative(f, "a/b") == r - - -def test_relative_3(): - for f, r in [ - ("a/b/c/d/libhdf5.so", ".."), - ("a/b/c/libhdf5.so", "."), - ("a/b/libhdf5.so", "./c"), - ("a/libhdf5.so", "./b/c"), - ("libhdf5.so", "./a/b/c"), - ("a/b/x/libhdf5.so", "../c"), - ("a/x/x/libhdf5.so", "../../b/c"), - ("x/x/x/libhdf5.so", "../../../a/b/c"), - ("x/x/libhdf5.so", "../../a/b/c"), - ("x/libhdf5.so", "../a/b/c"), - ]: - assert utils.relative(f, "a/b/c") == r - - -def test_relative_4(): - for f, r in [ - ("a/b/c/d/libhdf5.so", "."), - ("a/b/c/x/libhdf5.so", "../d"), - ("a/b/x/x/libhdf5.so", "../../c/d"), - ("a/x/x/x/libhdf5.so", "../../../b/c/d"), - ("x/x/x/x/libhdf5.so", "../../../../a/b/c/d"), - ]: - assert utils.relative(f, "a/b/c/d") == r - - def test_expand_globs(testing_workdir): sub_dir = os.path.join(testing_workdir, "sub1") os.mkdir(sub_dir) From 94aaf387c5bb34c475162fa44f4ad6ccc88c06bf Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Thu, 25 Jan 2024 22:50:41 -0600 Subject: [PATCH 09/11] Add entrypoint tests to recipe --- recipe/meta.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 9fcf09e836..77a8034891 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -68,12 +68,11 @@ test: - test_bdist_conda_setup.py commands: - python -m pip check - # builtin subcommands + # subcommands - conda --help - conda build --help - conda convert --help - conda develop --help - - conda index --help - conda inspect --help - conda inspect linkages --help # [unix] - conda inspect objects --help # [osx] @@ -81,6 +80,17 @@ test: - conda render --help - conda skeleton --help - conda debug --help + # entrypoints + - conda-build --help + - conda-convert --help + - conda-develop --help + - conda-inspect --help + - conda-inspect linkages --help # [unix] + - conda-inspect objects --help # [osx] + - conda-metapackage --help + - conda-render --help + - conda-skeleton --help + - conda-debug --help # bdist_conda - python test_bdist_conda_setup.py bdist_conda --help From 0ca49d7965d50ccf9c660cba831671713f20fc5f Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 26 Jan 2024 13:48:04 +0100 Subject: [PATCH 10/11] Merge removal into CHANGELOG. --- CHANGELOG.md | 52 ++++++++++++++++++++++++++ news/5151-remove-deprecations | 70 ----------------------------------- 2 files changed, 52 insertions(+), 70 deletions(-) delete mode 100644 news/5151-remove-deprecations diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f2b7d5298..a1937ae4c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,58 @@ * Mark `conda_build.inspect_pkg.check_install(package)` as pending deprecation in favor of `conda_build.inspect_pkg.check_install(subdir)`. (#5033) * Mark `conda_build.inspect_pkg.check_install(prepend)` as pending deprecation. (#5033) * Mark `conda_build.inspect_pkg.check_install(minimal_hint)` as pending deprecation. (#5033) +* Remove `conda_build.api.update_index`. (#5151) +* Remove `conda_build.cli.main_build.main`. (#5151) +* Remove `conda_build.cli.main_convert.main`. (#5151) +* Remove `conda_build.cli.main_debug.main`. (#5151) +* Remove `conda_build.cli.main_develop.main`. (#5151) +* Remove `conda_build.cli.main_index`. (#5151) +* Remove `conda_build.cli.main_inspect.main`. (#5151) +* Remove `conda_build.cli.main_metapackage.main`. (#5151) +* Remove `conda_build.cli.main_render.main`. (#5151) +* Remove `conda_build.cli.main_skeleton.main`. (#5151) +* Remove `conda_build.conda_interface.IndexRecord`. (#5151) +* Remove `conda_build.conda_interface.CrossPlatformStLink`. (#5151) +* Remove `conda_build.conda_interface.SignatureError`. (#5151) +* Remove `conda_build.conda_interface.which_package`. (#5151) +* Remove `conda_build.conda_interface.which_prefix`. (#5151) +* Remove `conda_build.conda_interface.get_installed_version`. (#5151) +* Remove `conda_build.config.python2_fs_encode`. (#5151) +* Remove `conda_build.config._ensure_dir`. (#5151) +* Remove `conda_build.config.Config.CONDA_LUA`. (#5151) +* Remove `conda_build.config.Config.CONDA_PY`. (#5151) +* Remove `conda_build.config.Config.CONDA_NPY`. (#5151) +* Remove `conda_build.config.Config.CONDA_PERL`. (#5151) +* Remove `conda_build.config.Config.CONDA_R`. (#5151) +* Remove `conda_build.environ.clean_pkg_cache`. (#5151) +* Remove `conda_build.index.update_index`. (#5151) +* Remove `conda_build.inspect_pkg.dist_files`. (#5151) +* Remove `conda_build.inspect_pkg.which_package(avoid_canonical_channel_name)`. (#5151) +* Remove `conda_build.inspect_pkg._installed`. (#5151) +* Remove `conda_build.metadata.Metadata.name(fail_ok)`. (#5151) +* Remove `conda_build.os_utils.ldd.get_package_files`. (#5151) +* Remove `conda_build.os_utils.liefldd.is_string`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type_liefldd`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type_pyldd`. (#5151) +* Remove `conda_build.os_utils.liefldd.codefile_type`. (#5151) +* Remove `conda_build.os_utils.pyldd.mach_o_change`. (#5151) +* Remove `conda_build.os_utils.pyldd.is_codefile`. (#5151) +* Remove `conda_build.os_utils.pyldd.codefile_type`. (#5151) +* Remove `conda_build.os_utils.pyldd.inspect_rpaths`. (#5151) +* Remove `conda_build.os_utils.pyldd.get_runpaths`. (#5151) +* Remove `conda_build.os_utils.pyldd.otool_sys`. (#5151) +* Remove `conda_build.os_utils.pyldd.ldd_sys`. (#5151) +* Remove `conda_build.plugin.index`. (#5151) +* Remove `conda_build.post.determine_package_nature`. (#5151) +* Remove `conda_build.post.library_nature(subdir)`. (#5151) +* Remove `conda_build.post.library_nature(bldpkgs_dirs)`. (#5151) +* Remove `conda_build.post.library_nature(output_folder)`. (#5151) +* Remove `conda_build.post.library_nature(channel_urls)`. (#5151) +* Remove `conda_build.post.dists_from_names`. (#5151) +* Remove `conda_build.post.FakeDist`. (#5151) +* Remove `conda_build.post._get_fake_pkg_dist`. (#5151) +* Remove `conda_build.utils.relative`. (#5151) +* Remove `conda_build.utils.samefile`. (#5151) ### Docs diff --git a/news/5151-remove-deprecations b/news/5151-remove-deprecations deleted file mode 100644 index 6bf3073a23..0000000000 --- a/news/5151-remove-deprecations +++ /dev/null @@ -1,70 +0,0 @@ -### Enhancements - -* - -### Bug fixes - -* - -### Deprecations - -* Remove `conda_build.api.update_index`. (#5151) -* Remove `conda_build.cli.main_build.main`. (#5151) -* Remove `conda_build.cli.main_convert.main`. (#5151) -* Remove `conda_build.cli.main_debug.main`. (#5151) -* Remove `conda_build.cli.main_develop.main`. (#5151) -* Remove `conda_build.cli.main_index`. (#5151) -* Remove `conda_build.cli.main_inspect.main`. (#5151) -* Remove `conda_build.cli.main_metapackage.main`. (#5151) -* Remove `conda_build.cli.main_render.main`. (#5151) -* Remove `conda_build.cli.main_skeleton.main`. (#5151) -* Remove `conda_build.conda_interface.IndexRecord`. (#5151) -* Remove `conda_build.conda_interface.CrossPlatformStLink`. (#5151) -* Remove `conda_build.conda_interface.SignatureError`. (#5151) -* Remove `conda_build.conda_interface.which_package`. (#5151) -* Remove `conda_build.conda_interface.which_prefix`. (#5151) -* Remove `conda_build.conda_interface.get_installed_version`. (#5151) -* Remove `conda_build.config.python2_fs_encode`. (#5151) -* Remove `conda_build.config._ensure_dir`. (#5151) -* Remove `conda_build.config.Config.CONDA_LUA`. (#5151) -* Remove `conda_build.config.Config.CONDA_PY`. (#5151) -* Remove `conda_build.config.Config.CONDA_NPY`. (#5151) -* Remove `conda_build.config.Config.CONDA_PERL`. (#5151) -* Remove `conda_build.config.Config.CONDA_R`. (#5151) -* Remove `conda_build.environ.clean_pkg_cache`. (#5151) -* Remove `conda_build.index.update_index`. (#5151) -* Remove `conda_build.inspect_pkg.dist_files`. (#5151) -* Remove `conda_build.inspect_pkg.which_package(avoid_canonical_channel_name)`. (#5151) -* Remove `conda_build.inspect_pkg._installed`. (#5151) -* Remove `conda_build.metadata.Metadata.name(fail_ok)`. (#5151) -* Remove `conda_build.os_utils.ldd.get_package_files`. (#5151) -* Remove `conda_build.os_utils.liefldd.is_string`. (#5151) -* Remove `conda_build.os_utils.liefldd.codefile_type_liefldd`. (#5151) -* Remove `conda_build.os_utils.liefldd.codefile_type_pyldd`. (#5151) -* Remove `conda_build.os_utils.liefldd.codefile_type`. (#5151) -* Remove `conda_build.os_utils.pyldd.mach_o_change`. (#5151) -* Remove `conda_build.os_utils.pyldd.is_codefile`. (#5151) -* Remove `conda_build.os_utils.pyldd.codefile_type`. (#5151) -* Remove `conda_build.os_utils.pyldd.inspect_rpaths`. (#5151) -* Remove `conda_build.os_utils.pyldd.get_runpaths`. (#5151) -* Remove `conda_build.os_utils.pyldd.otool_sys`. (#5151) -* Remove `conda_build.os_utils.pyldd.ldd_sys`. (#5151) -* Remove `conda_build.plugin.index`. (#5151) -* Remove `conda_build.post.determine_package_nature`. (#5151) -* Remove `conda_build.post.library_nature(subdir)`. (#5151) -* Remove `conda_build.post.library_nature(bldpkgs_dirs)`. (#5151) -* Remove `conda_build.post.library_nature(output_folder)`. (#5151) -* Remove `conda_build.post.library_nature(channel_urls)`. (#5151) -* Remove `conda_build.post.dists_from_names`. (#5151) -* Remove `conda_build.post.FakeDist`. (#5151) -* Remove `conda_build.post._get_fake_pkg_dist`. (#5151) -* Remove `conda_build.utils.relative`. (#5151) -* Remove `conda_build.utils.samefile`. (#5151) - -### Docs - -* - -### Other - -* From 3bd2747b19d93c6c13889edfc5167907ed12fe4b Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Fri, 26 Jan 2024 13:49:27 +0100 Subject: [PATCH 11/11] Use Sequence[str] for args type in main_convert Just for consistency with the other main_* modules. Signed-off-by: Marcel Bargull --- conda_build/cli/main_convert.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conda_build/cli/main_convert.py b/conda_build/cli/main_convert.py index c30f7982ab..14b5b4f9b0 100644 --- a/conda_build/cli/main_convert.py +++ b/conda_build/cli/main_convert.py @@ -5,7 +5,7 @@ import logging from argparse import Namespace from os.path import abspath, expanduser -from typing import Iterable +from typing import Sequence from .. import api from ..conda_interface import ArgumentParser @@ -37,7 +37,7 @@ """ -def parse_args(args: Iterable[str] | None) -> tuple[ArgumentParser, Namespace]: +def parse_args(args: Sequence[str] | None) -> tuple[ArgumentParser, Namespace]: parser = ArgumentParser( prog="conda convert", description=""" @@ -120,7 +120,7 @@ def parse_args(args: Iterable[str] | None) -> tuple[ArgumentParser, Namespace]: return parser, parser.parse_args(args) -def execute(args: Iterable[str] | None = None): +def execute(args: Sequence[str] | None = None): _, parsed = parse_args(args) files = parsed.files del parsed.__dict__["files"]