Skip to content

Commit

Permalink
Remove more 24.7.x deprecations (#5406)
Browse files Browse the repository at this point in the history
* Remove remaining sys.exit calls from build.py

* Remove sys.exit call from features.py

* Revert cleanup changes in build.py

* Remove sys.exit calls from main_build.py, update tests

* Revert changes to  in order to keep the PR small in scope

* Revert changes to  in order to keep the PR small in scope

* Add test for build.py, deprecate  constant

* Delete exception which will never get raised

* Remove deprecated code slated for removal in 24.7.x

* Revert changes from PR 5402

* Add news file

* Remove test_build.py test from #5402

* Remove more changes ported over from #5402

* Delete tests for 'conda build --test recipe/'

* Undo removal of '_construct_metadata_for_test_from_recipe()' and related tests, delay removal to 24.9.x release

* Update news file
  • Loading branch information
beeankha authored Jul 15, 2024
1 parent 23ae93f commit b12a180
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 96 deletions.
2 changes: 1 addition & 1 deletion conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2870,7 +2870,7 @@ def warn_on_use_of_SRC_DIR(metadata):

@deprecated(
"3.16.0",
"24.7.0",
"24.9.0",
addendum=(
"Test built packages instead, not recipes "
"(e.g., `conda build --test package` instead of `conda build --test recipe/`)."
Expand Down
95 changes: 0 additions & 95 deletions conda_build/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,41 +420,6 @@ def _get_all_dependencies(metadata, envs=("host", "build", "run")):
return reqs


@deprecated(
"24.5.1",
"24.7.0",
addendum="Use `conda_build.metadata._check_circular_dependencies` instead.",
)
def check_circular_dependencies(
render_order: dict[dict[str, Any], MetaData],
config: Config | None = None,
):
# deprecated since the input type (render_order) changed
envs: tuple[str, ...]
if config and config.host_subdir != config.build_subdir:
# When cross compiling build dependencies are already built
# and cannot come from the recipe as subpackages
envs = ("host", "run")
else:
envs = ("build", "host", "run")
pairs = []
for idx, m in enumerate(render_order.values()):
for other_m in list(render_order.values())[idx + 1 :]:
if any(
m.name() == dep or dep.startswith(m.name() + " ")
for dep in _get_all_dependencies(other_m, envs=envs)
) and any(
other_m.name() == dep or dep.startswith(other_m.name() + " ")
for dep in _get_all_dependencies(m, envs=envs)
):
pairs.append((m.name(), other_m.name()))
if pairs:
error = "Circular dependencies in recipe: \n"
for pair in pairs:
error += " {} <-> {}\n".format(*pair)
raise RecipeError(error)


def _check_circular_dependencies(
render_order: list[OutputTuple],
config: Config | None = None,
Expand Down Expand Up @@ -916,66 +881,6 @@ def _get_dependencies_from_environment(env_name_or_path):
return {"requirements": {"build": bootstrap_requirements}}


@deprecated(
"24.5.1",
"24.7.0",
addendum="Use `conda_build.metadata.toposort_outputs` instead.",
)
def toposort(output_metadata_map: dict[OutputDict, MetaData]):
# deprecated since input type (output_metadata_map) and output changed
from conda.common.toposort import _toposort

# We only care about the conda packages built by this recipe. Non-conda
# packages get sorted to the end.
these_packages = [
output_d["name"]
for output_d in output_metadata_map
if output_d.get("type", "conda").startswith("conda")
]
topodict: dict[str, set[str]] = dict()
order: dict[str, int] = dict()
endorder: set[int] = set()

for idx, (output_d, output_m) in enumerate(output_metadata_map.items()):
if output_d.get("type", "conda").startswith("conda"):
deps = output_m.get_value("requirements/run", []) + output_m.get_value(
"requirements/host", []
)
if not output_m.is_cross:
deps.extend(output_m.get_value("requirements/build", []))
name = output_d["name"]
order[name] = idx
topodict[name] = set()
for dep in deps:
dep = dep.split(" ")[0]
if dep in these_packages:
topodict[name].update((dep,))
else:
endorder.add(idx)

topo_order = list(_toposort(topodict))
keys = [
k
for pkgname in topo_order
for k in output_metadata_map.keys()
if "name" in k and k["name"] == pkgname
]
# not sure that this is working... not everything has 'name', and not sure how this pans out
# may end up excluding packages without the 'name' field
keys.extend(
[
k
for pkgname in endorder
for k in output_metadata_map.keys()
if ("name" in k and k["name"] == pkgname) or "name" not in k
]
)
result = OrderedDict()
for key in keys:
result[key] = output_metadata_map[key]
return result


def _toposort_outputs(output_tuples: list[OutputTuple]) -> list[OutputTuple]:
"""This function is used to work out the order to run the install scripts
for split packages based on any interdependencies. The result is just
Expand Down
21 changes: 21 additions & 0 deletions news/5406-remove-deprecated-code
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Enhancements

* <news item>

### Bug fixes

* <news item>

### Deprecations

* Remove the following deprecations:
* `conda_build.metadata.check_circular_dependencies` (use `conda_build.metadata._check_circular_dependencies` instead). (#5406)
* `conda_build.metadata.toposort` (use `conda_build.metadata.toposort_outputs` instead). (#5406)

### Docs

* <news item>

### Other

* <news item>

0 comments on commit b12a180

Please sign in to comment.