Avoid checking if a package is installed if it already failed (#56698)

This commit is contained in:
J. Nick Koston
2021-09-27 00:32:25 -05:00
committed by GitHub
parent 01bd3ff138
commit 0fce9f39b3
2 changed files with 4 additions and 6 deletions

View File

@@ -178,9 +178,6 @@ async def _async_process_requirements(
kwargs: Any,
) -> None:
"""Install a requirement and save failures."""
if pkg_util.is_installed(req):
return
if req in install_failure_history:
_LOGGER.info(
"Multiple attempts to install %s failed, install will be retried after next configuration check or restart",
@@ -188,6 +185,9 @@ async def _async_process_requirements(
)
raise RequirementsNotFound(name, [req])
if pkg_util.is_installed(req):
return
def _install(req: str, kwargs: dict[str, Any]) -> bool:
"""Install requirement."""
return pkg_util.install_package(req, **kwargs)