Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base image to 2023.10.0 #102126

Merged
merged 5 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
ARG BUILD_FROM
FROM ${BUILD_FROM}

# Synchronize with homeassistant/core.py:async_stop
ENV \
S6_SERVICES_GRACETIME=220000

ARG QEMU_CPU

WORKDIR /usr/src
Expand All @@ -14,41 +10,29 @@ COPY requirements.txt homeassistant/
COPY homeassistant/package_constraints.txt homeassistant/homeassistant/
RUN \
pip3 install \
--no-cache-dir \
--only-binary=:all: \
--index-url "https://wheels.home-assistant.io/musllinux-index/" \
-r homeassistant/requirements.txt

COPY requirements_all.txt home_assistant_frontend-* home_assistant_intents-* homeassistant/
RUN \
if ls homeassistant/home_assistant_frontend*.whl 1> /dev/null 2>&1; then \
pip3 install \
--no-cache-dir \
--no-index \
homeassistant/home_assistant_frontend-*.whl; \
pip3 install homeassistant/home_assistant_frontend-*.whl; \
fi \
&& if ls homeassistant/home_assistant_intents*.whl 1> /dev/null 2>&1; then \
pip3 install \
--no-cache-dir \
--no-index \
homeassistant/home_assistant_intents-*.whl; \
pip3 install homeassistant/home_assistant_intents-*.whl; \
fi \
&& \
LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \
MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \
pip3 install \
--no-cache-dir \
--only-binary=:all: \
--index-url "https://wheels.home-assistant.io/musllinux-index/" \
-r homeassistant/requirements_all.txt

## Setup Home Assistant Core
COPY . homeassistant/
RUN \
pip3 install \
--no-cache-dir \
--only-binary=:all: \
--index-url "https://wheels.home-assistant.io/musllinux-index/" \
-e ./homeassistant \
&& python3 -m compileall \
homeassistant/homeassistant
Expand Down
3 changes: 0 additions & 3 deletions homeassistant/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ def pip_kwargs(config_dir: str | None) -> dict[str, Any]:
is_docker = pkg_util.is_docker_env()
kwargs = {
"constraints": os.path.join(os.path.dirname(__file__), CONSTRAINT_FILE),
"no_cache_dir": is_docker,
"timeout": PIP_TIMEOUT,
}
if "WHEELS_LINKS" in os.environ:
kwargs["find_links"] = os.environ["WHEELS_LINKS"]
if not (config_dir is None or pkg_util.is_virtual_env()) and not is_docker:
kwargs["target"] = os.path.join(config_dir, "deps")
return kwargs
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/util/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ def install_package(
upgrade: bool = True,
target: str | None = None,
constraints: str | None = None,
find_links: str | None = None,
timeout: int | None = None,
no_cache_dir: bool | None = False,
) -> bool:
"""Install a package on PyPi. Accepts pip compatible package strings.

Expand All @@ -81,14 +79,10 @@ def install_package(
args = [sys.executable, "-m", "pip", "install", "--quiet", package]
if timeout:
args += ["--timeout", str(timeout)]
if no_cache_dir:
args.append("--no-cache-dir")
if upgrade:
args.append("--upgrade")
if constraints is not None:
args += ["--constraint", constraints]
if find_links is not None:
args += ["--find-links", find_links, "--prefer-binary"]
if target:
assert not is_virtual_env()
# This only works if not running in venv
Expand Down
5 changes: 0 additions & 5 deletions tests/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ async def test_requirement_installed_in_venv(hass: HomeAssistant) -> None:
"package==0.0.1",
constraints=os.path.join("ha_package_path", CONSTRAINT_FILE),
timeout=60,
no_cache_dir=False,
)


Expand All @@ -64,7 +63,6 @@ async def test_requirement_installed_in_deps(hass: HomeAssistant) -> None:
target=hass.config.path("deps"),
constraints=os.path.join("ha_package_path", CONSTRAINT_FILE),
timeout=60,
no_cache_dir=False,
)


Expand Down Expand Up @@ -379,10 +377,8 @@ async def test_install_with_wheels_index(hass: HomeAssistant) -> None:

assert mock_inst.call_args == call(
"hello==1.0.0",
find_links="https://wheels.hass.io/test",
constraints=os.path.join("ha_package_path", CONSTRAINT_FILE),
timeout=60,
no_cache_dir=True,
)


Expand All @@ -406,7 +402,6 @@ async def test_install_on_docker(hass: HomeAssistant) -> None:
"hello==1.0.0",
constraints=os.path.join("ha_package_path", CONSTRAINT_FILE),
timeout=60,
no_cache_dir=True,
)


Expand Down
27 changes: 0 additions & 27 deletions tests/util/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,33 +194,6 @@ def test_install_constraint(mock_sys, mock_popen, mock_env_copy, mock_venv) -> N
assert mock_popen.return_value.communicate.call_count == 1


def test_install_find_links(mock_sys, mock_popen, mock_env_copy, mock_venv) -> None:
"""Test install with find-links on not installed package."""
env = mock_env_copy()
link = "https://wheels-repository"
assert package.install_package(TEST_NEW_REQ, False, find_links=link)
assert mock_popen.call_count == 2
assert mock_popen.mock_calls[0] == call(
[
mock_sys.executable,
"-m",
"pip",
"install",
"--quiet",
TEST_NEW_REQ,
"--find-links",
link,
"--prefer-binary",
],
stdin=PIPE,
stdout=PIPE,
stderr=PIPE,
env=env,
close_fds=False,
)
assert mock_popen.return_value.communicate.call_count == 1


async def test_async_get_user_site(mock_env_copy) -> None:
"""Test async get user site directory."""
deps_dir = "/deps_dir"
Expand Down