From 977e6097d696aa9889c3e14e1ac5507a36bfefa9 Mon Sep 17 00:00:00 2001 From: Ken Odegard Date: Tue, 6 Aug 2024 18:02:34 -0500 Subject: [PATCH] 24.9 Removals (#5441) --- conda_build/build.py | 18 ------------------ conda_build/deprecations.py | 2 +- conda_build/metadata.py | 15 ++------------- news/5441-24.9-removals | 20 ++++++++++++++++++++ tests/test_build.py | 17 +---------------- 5 files changed, 24 insertions(+), 48 deletions(-) create mode 100644 news/5441-24.9-removals diff --git a/conda_build/build.py b/conda_build/build.py index 63e4c0bdc9..5d062f7720 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -76,7 +76,6 @@ CONDA_PACKAGE_EXTENSIONS, env_var, glob, - on_linux, on_mac, on_win, shutil_move_more_retrying, @@ -3583,23 +3582,6 @@ def tests_failed( raise CondaBuildUserError("TESTS FAILED: " + os.path.basename(pkg)) -@deprecated( - "24.7", - "24.9", - addendum="`patchelf` is an explicit conda-build dependency on Linux so it will always be installed.", -) -def check_external(): - if on_linux: - patchelf = external.find_executable("patchelf") - if patchelf is None: - raise CondaBuildUserError( - f"Did not find 'patchelf' in: {os.pathsep.join(external.dir_paths)} " - f"'patchelf' is necessary for building conda packages on Linux with " - f"relocatable ELF libraries. You can install patchelf using conda install " - f"patchelf." - ) - - def build_tree( recipe_list: Iterable[str | MetaData], config: Config, diff --git a/conda_build/deprecations.py b/conda_build/deprecations.py index cf87b4f25c..9155ed153d 100644 --- a/conda_build/deprecations.py +++ b/conda_build/deprecations.py @@ -299,7 +299,7 @@ def constant( def __getattr__(name: str) -> Any: if name == constant: - warnings.warn(message, category, stacklevel=2 + stack) + warnings.warn(message, category, stacklevel=3 + stack) return value if super_getattr: diff --git a/conda_build/metadata.py b/conda_build/metadata.py index 94f7bd889f..c254329d28 100644 --- a/conda_build/metadata.py +++ b/conda_build/metadata.py @@ -24,7 +24,6 @@ from . import utils from .config import Config, get_or_merge_config -from .deprecations import deprecated from .exceptions import ( CondaBuildException, CondaBuildUserError, @@ -55,7 +54,6 @@ ) if TYPE_CHECKING: - from pathlib import Path from typing import Any, Literal, Self OutputDict = dict[str, Any] @@ -855,21 +853,12 @@ def build_string_from_metadata(metadata): return build_str -@deprecated( - "24.7", "24.9", addendum="Use `conda.base.context.locate_prefix_by_name` instead." -) -def _get_env_path( - env_name_or_path: str | os.PathLike | Path, -) -> str | os.PathLike | Path: - return ( +def _get_dependencies_from_environment(env_name_or_path): + path = ( env_name_or_path if isdir(env_name_or_path) else locate_prefix_by_name(env_name_or_path) ) - - -def _get_dependencies_from_environment(env_name_or_path): - path = _get_env_path(env_name_or_path) # construct build requirements that replicate the given bootstrap environment # and concatenate them to the build requirements from the recipe bootstrap_metadata = get_installed_packages(path) diff --git a/news/5441-24.9-removals b/news/5441-24.9-removals new file mode 100644 index 0000000000..1613579d16 --- /dev/null +++ b/news/5441-24.9-removals @@ -0,0 +1,20 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* Remove `conda_build.build.check_external`. `patchelf` is an explicit conda-build dependency on Linux so it will always be installed. (#5441) +* Remove `conda_build.metadata._get_env_path`. Use `conda.base.context.locate_prefix_by_name` instead. (#5441) + +### Docs + +* + +### Other + +* diff --git a/tests/test_build.py b/tests/test_build.py index 52d1e5425b..40ed500020 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -15,7 +15,7 @@ from typing import TYPE_CHECKING import pytest -from conda.common.compat import on_linux, on_win +from conda.common.compat import on_win from conda_build import api, build from conda_build.exceptions import CondaBuildUserError @@ -338,21 +338,6 @@ def test_guess_interpreter( assert build.guess_interpreter(script) == interpreter -def test_check_external(): - with pytest.deprecated_call(): - build.check_external() - - -@pytest.mark.skipif(not on_linux, reason="pathelf is only available on Linux") -def test_check_external_user_error(mocker: MockerFixture) -> None: - mocker.patch( - "conda_build.os_utils.external.find_executable", - return_value=None, - ) - with pytest.raises(CondaBuildUserError): - build.check_external() - - @pytest.mark.parametrize("readme", ["README.md", "README.rst", "README"]) def test_copy_readme(testing_metadata: MetaData, readme: str): testing_metadata.meta["about"]["readme"] = readme