mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 20:27:08 +00:00
Switch out aiohttp-isal for aiohttp-fast-zlib to make isal optional (#116814)
* Switch out aiohttp-isal for aiohttp-fast-zlib to make isal optional aiohttp-isal does not work on core installs where the system has 32bit userland and a 64bit kernel because we have no way to detect this configuration or handle it. fixes #116681 * Update homeassistant/components/isal/manifest.json * Update homeassistant/components/isal/manifest.json * hassfest * isal * fixes * Apply suggestions from code review * make sure isal is updated before http * fix tests * late import
This commit is contained in:
parent
092a2de340
commit
673bbc1372
@ -692,6 +692,8 @@ build.json @home-assistant/supervisor
|
|||||||
/homeassistant/components/iqvia/ @bachya
|
/homeassistant/components/iqvia/ @bachya
|
||||||
/tests/components/iqvia/ @bachya
|
/tests/components/iqvia/ @bachya
|
||||||
/homeassistant/components/irish_rail_transport/ @ttroy50
|
/homeassistant/components/irish_rail_transport/ @ttroy50
|
||||||
|
/homeassistant/components/isal/ @bdraco
|
||||||
|
/tests/components/isal/ @bdraco
|
||||||
/homeassistant/components/islamic_prayer_times/ @engrbm87 @cpfair
|
/homeassistant/components/islamic_prayer_times/ @engrbm87 @cpfair
|
||||||
/tests/components/islamic_prayer_times/ @engrbm87 @cpfair
|
/tests/components/islamic_prayer_times/ @engrbm87 @cpfair
|
||||||
/homeassistant/components/iss/ @DurgNomis-drol
|
/homeassistant/components/iss/ @DurgNomis-drol
|
||||||
|
@ -21,7 +21,6 @@ from aiohttp.typedefs import JSONDecoder, StrOrURL
|
|||||||
from aiohttp.web_exceptions import HTTPMovedPermanently, HTTPRedirection
|
from aiohttp.web_exceptions import HTTPMovedPermanently, HTTPRedirection
|
||||||
from aiohttp.web_protocol import RequestHandler
|
from aiohttp.web_protocol import RequestHandler
|
||||||
from aiohttp_fast_url_dispatcher import FastUrlDispatcher, attach_fast_url_dispatcher
|
from aiohttp_fast_url_dispatcher import FastUrlDispatcher, attach_fast_url_dispatcher
|
||||||
from aiohttp_isal import enable_isal
|
|
||||||
from cryptography import x509
|
from cryptography import x509
|
||||||
from cryptography.hazmat.primitives import hashes, serialization
|
from cryptography.hazmat.primitives import hashes, serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||||
@ -54,6 +53,7 @@ from homeassistant.helpers.http import (
|
|||||||
HomeAssistantView,
|
HomeAssistantView,
|
||||||
current_request,
|
current_request,
|
||||||
)
|
)
|
||||||
|
from homeassistant.helpers.importlib import async_import_module
|
||||||
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
from homeassistant.helpers.network import NoURLAvailableError, get_url
|
||||||
from homeassistant.helpers.typing import ConfigType
|
from homeassistant.helpers.typing import ConfigType
|
||||||
from homeassistant.loader import bind_hass
|
from homeassistant.loader import bind_hass
|
||||||
@ -201,7 +201,9 @@ class ApiConfig:
|
|||||||
|
|
||||||
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
"""Set up the HTTP API and debug interface."""
|
"""Set up the HTTP API and debug interface."""
|
||||||
enable_isal()
|
# Late import to ensure isal is updated before
|
||||||
|
# we import aiohttp_fast_zlib
|
||||||
|
(await async_import_module(hass, "aiohttp_fast_zlib")).enable()
|
||||||
|
|
||||||
conf: ConfData | None = config.get(DOMAIN)
|
conf: ConfData | None = config.get(DOMAIN)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"domain": "http",
|
"domain": "http",
|
||||||
"name": "HTTP",
|
"name": "HTTP",
|
||||||
|
"after_dependencies": ["isal"],
|
||||||
"codeowners": ["@home-assistant/core"],
|
"codeowners": ["@home-assistant/core"],
|
||||||
"documentation": "https://www.home-assistant.io/integrations/http",
|
"documentation": "https://www.home-assistant.io/integrations/http",
|
||||||
"integration_type": "system",
|
"integration_type": "system",
|
||||||
|
20
homeassistant/components/isal/__init__.py
Normal file
20
homeassistant/components/isal/__init__.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"""The isal integration."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.helpers import config_validation as cv
|
||||||
|
from homeassistant.helpers.typing import ConfigType
|
||||||
|
|
||||||
|
DOMAIN = "isal"
|
||||||
|
|
||||||
|
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
||||||
|
|
||||||
|
|
||||||
|
async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||||
|
"""Set up up isal.
|
||||||
|
|
||||||
|
This integration is only used so that isal can be an optional
|
||||||
|
dep for aiohttp-fast-zlib.
|
||||||
|
"""
|
||||||
|
return True
|
10
homeassistant/components/isal/manifest.json
Normal file
10
homeassistant/components/isal/manifest.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"domain": "isal",
|
||||||
|
"name": "Intelligent Storage Acceleration",
|
||||||
|
"codeowners": ["@bdraco"],
|
||||||
|
"documentation": "https://www.home-assistant.io/integrations/isal",
|
||||||
|
"integration_type": "system",
|
||||||
|
"iot_class": "local_polling",
|
||||||
|
"quality_scale": "internal",
|
||||||
|
"requirements": ["isal==1.6.1"]
|
||||||
|
}
|
@ -4,7 +4,7 @@ aiodhcpwatcher==1.0.0
|
|||||||
aiodiscover==2.1.0
|
aiodiscover==2.1.0
|
||||||
aiodns==3.2.0
|
aiodns==3.2.0
|
||||||
aiohttp-fast-url-dispatcher==0.3.0
|
aiohttp-fast-url-dispatcher==0.3.0
|
||||||
aiohttp-isal==0.3.1
|
aiohttp-fast-zlib==0.1.0
|
||||||
aiohttp==3.9.5
|
aiohttp==3.9.5
|
||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
aiohttp_session==2.12.0
|
aiohttp_session==2.12.0
|
||||||
|
@ -28,7 +28,7 @@ dependencies = [
|
|||||||
"aiohttp_cors==0.7.0",
|
"aiohttp_cors==0.7.0",
|
||||||
"aiohttp_session==2.12.0",
|
"aiohttp_session==2.12.0",
|
||||||
"aiohttp-fast-url-dispatcher==0.3.0",
|
"aiohttp-fast-url-dispatcher==0.3.0",
|
||||||
"aiohttp-isal==0.3.1",
|
"aiohttp-fast-zlib==0.1.0",
|
||||||
"astral==2.2",
|
"astral==2.2",
|
||||||
"async-interrupt==1.1.1",
|
"async-interrupt==1.1.1",
|
||||||
"attrs==23.2.0",
|
"attrs==23.2.0",
|
||||||
|
@ -8,7 +8,7 @@ aiohttp==3.9.5
|
|||||||
aiohttp_cors==0.7.0
|
aiohttp_cors==0.7.0
|
||||||
aiohttp_session==2.12.0
|
aiohttp_session==2.12.0
|
||||||
aiohttp-fast-url-dispatcher==0.3.0
|
aiohttp-fast-url-dispatcher==0.3.0
|
||||||
aiohttp-isal==0.3.1
|
aiohttp-fast-zlib==0.1.0
|
||||||
astral==2.2
|
astral==2.2
|
||||||
async-interrupt==1.1.1
|
async-interrupt==1.1.1
|
||||||
attrs==23.2.0
|
attrs==23.2.0
|
||||||
|
@ -1160,6 +1160,9 @@ intellifire4py==2.2.2
|
|||||||
# homeassistant.components.iperf3
|
# homeassistant.components.iperf3
|
||||||
iperf3==0.1.11
|
iperf3==0.1.11
|
||||||
|
|
||||||
|
# homeassistant.components.isal
|
||||||
|
isal==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.gogogate2
|
# homeassistant.components.gogogate2
|
||||||
ismartgate==5.0.1
|
ismartgate==5.0.1
|
||||||
|
|
||||||
|
@ -941,6 +941,9 @@ insteon-frontend-home-assistant==0.5.0
|
|||||||
# homeassistant.components.intellifire
|
# homeassistant.components.intellifire
|
||||||
intellifire4py==2.2.2
|
intellifire4py==2.2.2
|
||||||
|
|
||||||
|
# homeassistant.components.isal
|
||||||
|
isal==1.6.1
|
||||||
|
|
||||||
# homeassistant.components.gogogate2
|
# homeassistant.components.gogogate2
|
||||||
ismartgate==5.0.1
|
ismartgate==5.0.1
|
||||||
|
|
||||||
|
1
tests/components/isal/__init__.py
Normal file
1
tests/components/isal/__init__.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
"""Tests for the Intelligent Storage Acceleration integration."""
|
10
tests/components/isal/test_init.py
Normal file
10
tests/components/isal/test_init.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"""Test the Intelligent Storage Acceleration setup."""
|
||||||
|
|
||||||
|
from homeassistant.components.isal import DOMAIN
|
||||||
|
from homeassistant.core import HomeAssistant
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
|
||||||
|
async def test_setup(hass: HomeAssistant) -> None:
|
||||||
|
"""Ensure we can setup."""
|
||||||
|
assert await async_setup_component(hass, DOMAIN, {})
|
@ -591,7 +591,7 @@ async def test_discovery_requirements_mqtt(hass: HomeAssistant) -> None:
|
|||||||
) as mock_process:
|
) as mock_process:
|
||||||
await async_get_integration_with_requirements(hass, "mqtt_comp")
|
await async_get_integration_with_requirements(hass, "mqtt_comp")
|
||||||
|
|
||||||
assert len(mock_process.mock_calls) == 1
|
assert len(mock_process.mock_calls) == 2
|
||||||
assert mock_process.mock_calls[0][1][1] == mqtt.requirements
|
assert mock_process.mock_calls[0][1][1] == mqtt.requirements
|
||||||
|
|
||||||
|
|
||||||
@ -608,12 +608,13 @@ async def test_discovery_requirements_ssdp(hass: HomeAssistant) -> None:
|
|||||||
) as mock_process:
|
) as mock_process:
|
||||||
await async_get_integration_with_requirements(hass, "ssdp_comp")
|
await async_get_integration_with_requirements(hass, "ssdp_comp")
|
||||||
|
|
||||||
assert len(mock_process.mock_calls) == 3
|
assert len(mock_process.mock_calls) == 4
|
||||||
assert mock_process.mock_calls[0][1][1] == ssdp.requirements
|
assert mock_process.mock_calls[0][1][1] == ssdp.requirements
|
||||||
assert {
|
assert {
|
||||||
mock_process.mock_calls[1][1][0],
|
mock_process.mock_calls[1][1][0],
|
||||||
mock_process.mock_calls[2][1][0],
|
mock_process.mock_calls[2][1][0],
|
||||||
} == {"network", "recorder"}
|
mock_process.mock_calls[3][1][0],
|
||||||
|
} == {"network", "recorder", "isal"}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -637,7 +638,7 @@ async def test_discovery_requirements_zeroconf(
|
|||||||
) as mock_process:
|
) as mock_process:
|
||||||
await async_get_integration_with_requirements(hass, "comp")
|
await async_get_integration_with_requirements(hass, "comp")
|
||||||
|
|
||||||
assert len(mock_process.mock_calls) == 3
|
assert len(mock_process.mock_calls) == 4
|
||||||
assert mock_process.mock_calls[0][1][1] == zeroconf.requirements
|
assert mock_process.mock_calls[0][1][1] == zeroconf.requirements
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user