From f3e91fde6500e32287f93b11ed2b97a9c57b7132 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 10 Jan 2024 13:46:04 +0100 Subject: [PATCH] safe access to addon toml data --- dependencies/core.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dependencies/core.py b/dependencies/core.py index 89da38a99..9844687a2 100755 --- a/dependencies/core.py +++ b/dependencies/core.py @@ -319,7 +319,7 @@ def merge_tomls( dependency_keys = ["dependencies"] for key in dependency_keys: main_poetry = main_toml["tool"]["poetry"].setdefault(key, {}) - addon_poetry = addon_toml["tool"]["poetry"].get(key) + addon_poetry = addon_toml.get("tool", {}).get("poetry", {}).get(key) if not addon_poetry: continue @@ -465,8 +465,7 @@ def get_full_toml(base_toml_data, addon_tomls, platform_name): """ # Fix git sources of installer dependencies - main_poetry_tool = base_toml_data["tool"]["poetry"] - main_dependencies = main_poetry_tool["dependencies"] + main_dependencies = base_toml_data["tool"]["poetry"]["dependencies"] modified_dependencies = {} for key, value in main_dependencies.items(): if not isinstance(value, str): @@ -501,8 +500,7 @@ def get_full_toml(base_toml_data, addon_tomls, platform_name): ) # Convert all 'ConstraintClassesHint' to 'str' - main_poetry_tool = base_toml_data["tool"]["poetry"] - main_dependencies = main_poetry_tool["dependencies"] + main_dependencies = base_toml_data["tool"]["poetry"]["dependencies"] modified_dependencies = {} for key, value in main_dependencies.items(): if not isinstance(value, (str, dict)):