Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate conda_build.api.get_output_file_path #5208

Merged
merged 7 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions conda_build/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/source/resources/variants.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 19 additions & 0 deletions news/5208-deprecate-get_output_file_path
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Mark `conda_build.api.get_output_file_path` as deprecated. Use `conda_build.api.get_output_file_paths` instead. (#5208)

### Docs

* <news item>

### Other

* <news item>
2 changes: 1 addition & 1 deletion tests/cli/test_main_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
)

Expand Down Expand Up @@ -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)

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_api_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down
6 changes: 3 additions & 3 deletions tests/test_subpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading