fix(tools): idf_tools.py uninstall decide based on preferred tool version

idf_tools.py uninstall now doesn't take only recommended version, but
makes the decision based on preferred installed versions.
This commit is contained in:
Marek Fiala
2025-06-02 16:07:24 +02:00
committed by BOT
parent 335ba6b3c2
commit bd0873f9ec

View File

@@ -3150,7 +3150,7 @@ def action_uninstall(args: Any) -> None:
os.listdir(os.path.join(tools_path, tool)) if os.path.isdir(os.path.join(tools_path, tool)) else []
)
try:
unused_versions = [x for x in tool_versions if x != tools_info[tool].get_recommended_version()]
unused_versions = [x for x in tool_versions if x != tools_info[tool].get_preferred_installed_version()]
except (
KeyError
): # When tool that is not supported by tools_info (tools.json) anymore, remove the whole tool file
@@ -3206,7 +3206,7 @@ def action_uninstall(args: Any) -> None:
tool_name, tool_version = tool_spec.split('@', 1)
tool_obj = tools_info_for_platform[tool_name]
if tool_version is None:
tool_version = tool_obj.get_recommended_version()
tool_version = tool_obj.get_preferred_installed_version()
# mypy-checks
if tool_version is not None:
archive_version = tool_obj.versions[tool_version].get_download_for_platform(CURRENT_PLATFORM)