From 56a2a80bdd8f1c3f0c1355dcd32ed7d888532ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20C=C3=A9dric=20Pradat?= Date: Mon, 9 Dec 2024 17:52:40 +0100 Subject: [PATCH] Fix: change definition of pkg_type variable in build function to solve KeyError: 'conda' (#5560) Co-authored-by: jaimergp Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- conda_build/build.py | 5 ++++- news/5560-fix-pkg-type-key-error | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 news/5560-fix-pkg-type-key-error diff --git a/conda_build/build.py b/conda_build/build.py index 4acb1bd9d9..74c7f03811 100644 --- a/conda_build/build.py +++ b/conda_build/build.py @@ -2760,7 +2760,10 @@ def build( # can be different from the env for the top level build. with utils.path_prepended(m.config.build_prefix): env = environ.get_dict(m=m) - pkg_type = "conda" if not hasattr(m, "type") else m.type + pkg_type = ( + getattr(m, "type", m.config.conda_pkg_format) + or CondaPkgFormat.V2 + ) newly_built_packages = bundlers[pkg_type]( output_d, m, env, stats, new_prefix_files ) diff --git a/news/5560-fix-pkg-type-key-error b/news/5560-fix-pkg-type-key-error new file mode 100644 index 0000000000..19ca33c226 --- /dev/null +++ b/news/5560-fix-pkg-type-key-error @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* Fix `KeyError` when an inconsistent `build.pkg_type` value is specified in `meta.yaml`. (#5560) + +### Deprecations + +* + +### Docs + +* + +### Other + +*