diff --git a/conda_build/api.py b/conda_build/api.py index 8a1298bbe9..a8fc525e66 100644 --- a/conda_build/api.py +++ b/conda_build/api.py @@ -20,13 +20,13 @@ # 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, ensure_list, expand_globs, find_recipe, - get_logger, get_skip_message, on_win, ) @@ -168,6 +168,7 @@ def get_output_file_paths( return sorted(list(set(outs))) +@deprecated("24.3.0", "24.5.0", addendum="Use `get_output_file_paths` instead.") def get_output_file_path( recipe_path_or_metadata, no_download_source=False, @@ -180,12 +181,6 @@ def get_output_file_path( Both split packages (recipes with more than one output) and build matrices, created with variants, contribute to the list of file paths here. """ - log = get_logger(__name__) - log.warn( - "deprecation warning: this function has been renamed to get_output_file_paths, " - "to reflect that potentially multiple paths are returned. This function will be " - "removed in the conda-build 4.0 release." - ) return get_output_file_paths( recipe_path_or_metadata, no_download_source=no_download_source, diff --git a/docs/source/resources/variants.rst b/docs/source/resources/variants.rst index 3209fd3620..90953126ee 100644 --- a/docs/source/resources/variants.rst +++ b/docs/source/resources/variants.rst @@ -323,7 +323,7 @@ your Jinja2 templates. There are two ways that you can feed this information into the API: 1. Pass the ``variants`` keyword argument to API functions. Currently, the - ``build``, ``render``, ``get_output_file_path``, and ``check`` functions + ``build``, ``render``, ``get_output_file_paths``, and ``check`` functions accept this argument. ``variants`` should be a dictionary where each value is a list of versions to iterate over. These are aggregated as detailed in the `Aggregation of multiple variants`_ section below. diff --git a/news/5208-deprecate-get_output_file_path b/news/5208-deprecate-get_output_file_path new file mode 100644 index 0000000000..33244e8bf5 --- /dev/null +++ b/news/5208-deprecate-get_output_file_path @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* + +### Deprecations + +* Mark `conda_build.api.get_output_file_path` as deprecated. Use `conda_build.api.get_output_file_paths` instead. (#5208) + +### Docs + +* + +### Other + +* diff --git a/tests/cli/test_main_build.py b/tests/cli/test_main_build.py index 60f24cf7ca..9da5b48418 100644 --- a/tests/cli/test_main_build.py +++ b/tests/cli/test_main_build.py @@ -296,7 +296,7 @@ def test_no_force_upload( # render recipe api.output_yaml(testing_metadata, "meta.yaml") - pkg = api.get_output_file_path(testing_metadata) + pkg = api.get_output_file_paths(testing_metadata) # mock Config.set_keys to always set anaconda_upload to True # conda's Context + conda_build's MetaData & Config objects interact in such an diff --git a/tests/test_api_build.py b/tests/test_api_build.py index 6ad6577c50..0d2bd3b5f0 100644 --- a/tests/test_api_build.py +++ b/tests/test_api_build.py @@ -242,7 +242,7 @@ def test_offline( def test_git_describe_info_on_branch(testing_config): recipe_path = os.path.join(metadata_dir, "_git_describe_number_branch") m = api.render(recipe_path, config=testing_config)[0][0] - output = api.get_output_file_path(m)[0] + output = api.get_output_file_paths(m)[0] # missing hash because we set custom build string in meta.yaml test_path = os.path.join( testing_config.croot, @@ -625,7 +625,7 @@ def test_numpy_setup_py_data(testing_config): m = api.render(recipe_path, config=testing_config, numpy="1.16")[0][0] _hash = m.hash_dependencies() assert ( - os.path.basename(api.get_output_file_path(m)[0]) + os.path.basename(api.get_output_file_paths(m)[0]) == f"load_setup_py_test-0.1.0-np116py{sys.version_info.major}{sys.version_info.minor}{_hash}_0.tar.bz2" ) @@ -795,7 +795,7 @@ def test_relative_git_url_submodule_clone(testing_workdir, testing_config, monke # This will (after one spin round the loop) install and run 'git' with the # build env prepended to os.environ[] metadata = api.render(testing_workdir, config=testing_config)[0][0] - output = api.get_output_file_path(metadata, config=testing_config)[0] + output = api.get_output_file_paths(metadata, config=testing_config)[0] assert f"relative_submodules-{tag}-" in output api.build(metadata, config=testing_config) @@ -811,7 +811,7 @@ def test_noarch(testing_workdir): ) with open(filename, "w") as outfile: outfile.write(yaml.dump(data, default_flow_style=False, width=999999999)) - output = api.get_output_file_path(testing_workdir)[0] + output = api.get_output_file_paths(testing_workdir)[0] assert os.path.sep + "noarch" + os.path.sep in output or not noarch assert os.path.sep + "noarch" + os.path.sep not in output or noarch diff --git a/tests/test_api_consistency.py b/tests/test_api_consistency.py index 56685f66d1..9d88b60eee 100644 --- a/tests/test_api_consistency.py +++ b/tests/test_api_consistency.py @@ -43,7 +43,7 @@ def test_api_output_yaml(): def test_api_get_output_file_path(): - argspec = getargspec(api.get_output_file_path) + argspec = getargspec(api.get_output_file_paths) assert argspec.args == [ "recipe_path_or_metadata", "no_download_source", diff --git a/tests/test_api_render.py b/tests/test_api_render.py index 878617e78d..868053876b 100644 --- a/tests/test_api_render.py +++ b/tests/test_api_render.py @@ -105,7 +105,7 @@ def test_get_output_file_path_jinja2(testing_config): def test_output_without_jinja_does_not_download(mocker, testing_config): mock = mocker.patch("conda_build.source") - api.get_output_file_path( + api.get_output_file_paths( os.path.join(metadata_dir, "source_git"), config=testing_config ) mock.assert_not_called() diff --git a/tests/test_render.py b/tests/test_render.py index 6cfd0abeea..aef9d0e928 100644 --- a/tests/test_render.py +++ b/tests/test_render.py @@ -27,7 +27,7 @@ ) def test_noarch_output(build, testing_metadata): testing_metadata.meta["build"].update(build) - output = api.get_output_file_path(testing_metadata) + output = api.get_output_file_paths(testing_metadata) assert os.path.sep + "noarch" + os.path.sep in output[0] diff --git a/tests/test_subpackages.py b/tests/test_subpackages.py index 3937036d14..3c3b011c58 100644 --- a/tests/test_subpackages.py +++ b/tests/test_subpackages.py @@ -55,7 +55,7 @@ def test_rm_rf_does_not_remove_relative_source_package_files( def test_output_pkg_path_shows_all_subpackages(testing_metadata): testing_metadata.meta["outputs"] = [{"name": "a"}, {"name": "b"}] out_dicts_and_metadata = testing_metadata.get_output_metadata_set() - outputs = api.get_output_file_path( + outputs = api.get_output_file_paths( [(m, None, None) for (_, m) in out_dicts_and_metadata] ) assert len(outputs) == 2 @@ -64,7 +64,7 @@ def test_output_pkg_path_shows_all_subpackages(testing_metadata): def test_subpackage_version_provided(testing_metadata): testing_metadata.meta["outputs"] = [{"name": "a", "version": "2.0"}] out_dicts_and_metadata = testing_metadata.get_output_metadata_set() - outputs = api.get_output_file_path( + outputs = api.get_output_file_paths( [(m, None, None) for (_, m) in out_dicts_and_metadata] ) assert len(outputs) == 1 @@ -78,7 +78,7 @@ def test_subpackage_independent_hash(testing_metadata): testing_metadata.meta["requirements"]["run"] = ["a"] out_dicts_and_metadata = testing_metadata.get_output_metadata_set() assert len(out_dicts_and_metadata) == 2 - outputs = api.get_output_file_path( + outputs = api.get_output_file_paths( [(m, None, None) for (_, m) in out_dicts_and_metadata] ) assert len(outputs) == 2