From bca0dc627de55a32c087da0d0e9c91d3c5aefbb5 Mon Sep 17 00:00:00 2001 From: Robert Resch Date: Fri, 15 Mar 2024 13:53:07 +0000 Subject: [PATCH] Revert changes from #112496 so this PR can be merged independently --- Dockerfile | 30 ++++++++------------- requirements_test.txt | 2 +- script/hassfest/docker.py | 57 +++++++++------------------------------ 3 files changed, 24 insertions(+), 65 deletions(-) diff --git a/Dockerfile b/Dockerfile index c187fb82e3dcbc..da46f71ad22ab8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,55 +6,47 @@ FROM ${BUILD_FROM} # Synchronize with homeassistant/core.py:async_stop ENV \ - S6_SERVICES_GRACETIME=240000 \ - UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" \ - UV_NO_CACHE=true \ - PATH="$PATH:/root/.cargo/bin" \ - UV_SYSTEM_PYTHON=true + S6_SERVICES_GRACETIME=240000 ARG QEMU_CPU -# Set shell -SHELL ["/bin/ash", "-o", "pipefail", "-c"] -# Install uv -RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.1.21/uv-installer.sh | sh - WORKDIR /usr/src ## Setup Home Assistant Core dependencies COPY requirements.txt homeassistant/ COPY homeassistant/package_constraints.txt homeassistant/homeassistant/ RUN \ - uv pip install \ - --no-build \ + pip3 install \ + --only-binary=:all: \ -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 \ - uv pip install 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 \ - uv pip install homeassistant/home_assistant_intents-*.whl; \ + pip3 install homeassistant/home_assistant_intents-*.whl; \ fi \ && if [ "${BUILD_ARCH}" = "i386" ]; then \ LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \ - linux32 uv pip install \ - --no-build \ + linux32 pip3 install \ + --only-binary=:all: \ -r homeassistant/requirements_all.txt; \ else \ LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \ - uv pip install \ - --no-build \ + pip3 install \ + --only-binary=:all: \ -r homeassistant/requirements_all.txt; \ fi ## Setup Home Assistant Core COPY . homeassistant/ RUN \ - uv pip install \ + pip3 install \ + --only-binary=:all: \ -e ./homeassistant \ && python3 -m compileall \ homeassistant/homeassistant diff --git a/requirements_test.txt b/requirements_test.txt index b3011f44e5f0b6..03a61613600e22 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -50,4 +50,4 @@ types-pytz==2023.3.1.1 types-PyYAML==6.0.12.12 types-requests==2.31.0.3 types-xmltodict==0.13.0.3 -uv==0.1.21 \ No newline at end of file +uv==0.1.17 \ No newline at end of file diff --git a/script/hassfest/docker.py b/script/hassfest/docker.py index 002feb03daa783..49b457f8a74b74 100644 --- a/script/hassfest/docker.py +++ b/script/hassfest/docker.py @@ -4,7 +4,6 @@ from homeassistant.util import executor, thread from .model import Config, Integration -from .requirements import PACKAGE_REGEX, PIP_VERSION_RANGE_SEPARATOR DOCKERFILE_TEMPLATE = r"""# Automatically generated by hassfest. # @@ -14,55 +13,47 @@ # Synchronize with homeassistant/core.py:async_stop ENV \ - S6_SERVICES_GRACETIME={timeout} \ - UV_EXTRA_INDEX_URL="https://wheels.home-assistant.io/musllinux-index/" \ - UV_NO_CACHE=true \ - PATH="$PATH:/root/.cargo/bin" \ - UV_SYSTEM_PYTHON=true + S6_SERVICES_GRACETIME={timeout} ARG QEMU_CPU -# Set shell -SHELL ["/bin/ash", "-o", "pipefail", "-c"] -# Install uv -RUN curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/{uv_version}/uv-installer.sh | sh - WORKDIR /usr/src ## Setup Home Assistant Core dependencies COPY requirements.txt homeassistant/ COPY homeassistant/package_constraints.txt homeassistant/homeassistant/ RUN \ - uv pip install \ - --no-build \ + pip3 install \ + --only-binary=:all: \ -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 \ - uv pip install 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 \ - uv pip install homeassistant/home_assistant_intents-*.whl; \ + pip3 install homeassistant/home_assistant_intents-*.whl; \ fi \ && if [ "${{BUILD_ARCH}}" = "i386" ]; then \ LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \ - linux32 uv pip install \ - --no-build \ + linux32 pip3 install \ + --only-binary=:all: \ -r homeassistant/requirements_all.txt; \ else \ LD_PRELOAD="/usr/local/lib/libjemalloc.so.2" \ MALLOC_CONF="background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000" \ - uv pip install \ - --no-build \ + pip3 install \ + --only-binary=:all: \ -r homeassistant/requirements_all.txt; \ fi ## Setup Home Assistant Core COPY . homeassistant/ RUN \ - uv pip install \ + pip3 install \ + --only-binary=:all: \ -e ./homeassistant \ && python3 -m compileall \ homeassistant/homeassistant @@ -74,28 +65,6 @@ """ -def _get_uv_version() -> str: - with open("requirements_test.txt") as fp: - for _, line in enumerate(fp): - if match := PACKAGE_REGEX.match(line): - pkg, sep, version = match.groups() - - if pkg != "uv": - continue - - if sep != "==" or not version: - raise RuntimeError( - 'Requirement uv need to be pinned "uv==".' - ) - - for part in version.split(";", 1)[0].split(","): - version_part = PIP_VERSION_RANGE_SEPARATOR.match(part) - if version_part: - return version_part.group(2) - - raise RuntimeError("Invalid uv requirement in requirements_test.txt") - - def _generate_dockerfile() -> str: timeout = ( core.STOPPING_STAGE_SHUTDOWN_TIMEOUT @@ -106,9 +75,7 @@ def _generate_dockerfile() -> str: + thread.THREADING_SHUTDOWN_TIMEOUT + 10 ) - return DOCKERFILE_TEMPLATE.format( - timeout=timeout * 1000, uv_version=_get_uv_version() - ) + return DOCKERFILE_TEMPLATE.format(timeout=timeout * 1000) def validate(integrations: dict[str, Integration], config: Config) -> None: