From 9e3f7f177b80f7b1d843f3f03e64a7808a5e524c Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 18 Oct 2023 15:21:45 +0200 Subject: [PATCH] Add pip.conf with defaults (#641) --- .hadolint.yaml | 6 +++--- Dockerfile | 13 +++++++------ builder/pip.py | 8 ++++---- rootfs/etc/pip.conf | 7 +++++++ 4 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 rootfs/etc/pip.conf diff --git a/.hadolint.yaml b/.hadolint.yaml index 0710c3c9..83c4af53 100644 --- a/.hadolint.yaml +++ b/.hadolint.yaml @@ -1,7 +1,7 @@ ignored: - - DL3018 + - DL3003 - DL3006 - DL3013 - - DL3003 - - SC2155 + - DL3018 + - DL3042 - SC2086 diff --git a/Dockerfile b/Dockerfile index d2c332a2..c9fc00ce 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,15 @@ ARG \ BUILD_ARCH \ CPYTHON_ABI \ QEMU_CPU \ - AUDITWHEEL_VERSION=5.1.2 + AUDITWHEEL_VERSION=5.1.2 \ + PIP_EXTRA_INDEX_URL=https://wheels.home-assistant.io/musllinux-index/ \ WORKDIR /usr/src SHELL ["/bin/bash", "-exo", "pipefail", "-c"] +COPY rootfs / + # Install requirements COPY \ requirements.txt \ @@ -38,10 +41,9 @@ RUN \ apk add --no-cache --virtual .build-dependencies2 \ openblas-dev; \ fi \ - && pip3 install --no-cache-dir \ + && pip3 install \ -r /usr/src/requirements.txt \ -r /usr/src/requirements_${CPYTHON_ABI}.txt \ - --extra-index-url "https://wheels.home-assistant.io/musllinux-index/" \ && rm -rf /usr/src/* # Install auditwheel @@ -52,14 +54,14 @@ RUN \ https://github.com/pypa/auditwheel \ && cd auditwheel \ && git apply /usr/src/0001-Support-musllinux-armv6l.patch \ - && pip install --no-cache-dir . \ + && pip install . \ && rm -rf /usr/src/* # Install builder COPY . /usr/src/builder/ RUN \ set -x \ - && pip3 install --no-cache-dir /usr/src/builder/ \ + && pip3 install /usr/src/builder/ \ && rm -rf /usr/src/* # Set build environment information @@ -69,6 +71,5 @@ ENV \ # Runtime WORKDIR /data -COPY rootfs / ENTRYPOINT [ "run-builder.sh" ] diff --git a/builder/pip.py b/builder/pip.py index 1b8f2d64..4b9b68a3 100644 --- a/builder/pip.py +++ b/builder/pip.py @@ -25,7 +25,7 @@ def build_wheels_package( constraint_cmd = f"--constraint {constraint}" if constraint else "" run_command( - f'pip3 wheel --disable-pip-version-check --progress-bar off --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --extra-index-url {index} {constraint_cmd} "{package}"', + f'pip3 wheel --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --extra-index-url {index} {constraint_cmd} "{package}"', env=build_env, timeout=timeout, ) @@ -50,7 +50,7 @@ def build_wheels_requirement( constraint_cmd = f"--constraint {constraint}" if constraint else "" run_command( - f'pip3 wheel --disable-pip-version-check --progress-bar off --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --extra-index-url {index} {constraint_cmd} --requirement {requirement}', + f'pip3 wheel --no-clean --no-binary "{skip_binary}" --wheel-dir {output} --extra-index-url {index} {constraint_cmd} --requirement {requirement}', env=build_env, timeout=timeout, ) @@ -68,7 +68,7 @@ def build_wheels_local( build_env["MAKEFLAGS"] = f"-j{cpu}" run_command( - f"pip3 wheel --disable-pip-version-check --progress-bar off --no-clean --wheel-dir {output} --extra-index-url {index} .", + f"pip3 wheel --no-clean --wheel-dir {output} --extra-index-url {index} .", env=build_env, ) @@ -119,5 +119,5 @@ def install_pips(index: str, pips: str) -> None: packages = " ".join(pips.split(";")) run_command( - f"pip install --disable-pip-version-check --progress-bar off --upgrade --no-cache-dir --prefer-binary --extra-index-url {index} {packages}", + f"pip install --upgrade --extra-index-url {index} {packages}", ) diff --git a/rootfs/etc/pip.conf b/rootfs/etc/pip.conf new file mode 100644 index 00000000..40d3ae1a --- /dev/null +++ b/rootfs/etc/pip.conf @@ -0,0 +1,7 @@ +[global] +disable-pip-version-check = true +progress-bar = off + +[install] +no-cache-dir = false +prefer-binary = true