mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Avoid checking if a package is installed if it already failed (#56698)
This commit is contained in:
parent
01bd3ff138
commit
0fce9f39b3
@ -178,9 +178,6 @@ async def _async_process_requirements(
|
|||||||
kwargs: Any,
|
kwargs: Any,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Install a requirement and save failures."""
|
"""Install a requirement and save failures."""
|
||||||
if pkg_util.is_installed(req):
|
|
||||||
return
|
|
||||||
|
|
||||||
if req in install_failure_history:
|
if req in install_failure_history:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
"Multiple attempts to install %s failed, install will be retried after next configuration check or restart",
|
"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])
|
raise RequirementsNotFound(name, [req])
|
||||||
|
|
||||||
|
if pkg_util.is_installed(req):
|
||||||
|
return
|
||||||
|
|
||||||
def _install(req: str, kwargs: dict[str, Any]) -> bool:
|
def _install(req: str, kwargs: dict[str, Any]) -> bool:
|
||||||
"""Install requirement."""
|
"""Install requirement."""
|
||||||
return pkg_util.install_package(req, **kwargs)
|
return pkg_util.install_package(req, **kwargs)
|
||||||
|
@ -213,10 +213,8 @@ async def test_get_integration_with_requirements_pip_install_fails_two_passes(ha
|
|||||||
assert integration
|
assert integration
|
||||||
assert integration.domain == "test_component"
|
assert integration.domain == "test_component"
|
||||||
|
|
||||||
assert len(mock_is_installed.mock_calls) == 3
|
assert len(mock_is_installed.mock_calls) == 1
|
||||||
assert sorted(mock_call[1][0] for mock_call in mock_is_installed.mock_calls) == [
|
assert sorted(mock_call[1][0] for mock_call in mock_is_installed.mock_calls) == [
|
||||||
"test-comp-after-dep==1.0.0",
|
|
||||||
"test-comp-dep==1.0.0",
|
|
||||||
"test-comp==1.0.0",
|
"test-comp==1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user