From 38756119c486647a1a3020570576ff5301e78278 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 10 Nov 2024 16:21:50 +0100 Subject: [PATCH] Pass `--ignore-installed` to pip in most of the cases. The only case where it's fine to overwrite existing Python packages with pip versions is when Platypush is running in a virtual environment. Otherwise, keep the system-installed version if it's available, unless its version is explicitly incompatible with the one reported in `requirements.txt`. --- platypush/install/docker/alpine.Dockerfile | 2 +- platypush/install/docker/debian.Dockerfile | 2 +- platypush/install/docker/fedora.Dockerfile | 2 +- platypush/install/docker/ubuntu.Dockerfile | 2 +- platypush/utils/manifest.py | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/platypush/install/docker/alpine.Dockerfile b/platypush/install/docker/alpine.Dockerfile index 8e9f92374c..20df11438b 100644 --- a/platypush/install/docker/alpine.Dockerfile +++ b/platypush/install/docker/alpine.Dockerfile @@ -18,7 +18,7 @@ RUN --mount=type=bind,source=.,target=/curdir \ RUN /install/platypush/install/scripts/alpine/install.sh && \ cd /install && \ - pip install -U --no-input --no-cache-dir --no-deps . croniter --break-system-packages && \ + pip install -U --no-input --no-cache-dir --no-deps --ignore-installed --break-system-packages . croniter && \ rm -rf /install && \ rm -rf /root/.cache && \ apk del gcc git && \ diff --git a/platypush/install/docker/debian.Dockerfile b/platypush/install/docker/debian.Dockerfile index 5f9c67359c..bcf3de984a 100644 --- a/platypush/install/docker/debian.Dockerfile +++ b/platypush/install/docker/debian.Dockerfile @@ -21,7 +21,7 @@ RUN --mount=type=bind,source=.,target=/curdir \ RUN /install/platypush/install/scripts/debian/install.sh && \ cd /install && \ - pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \ + pip install -U --no-input --no-cache-dir --no-deps --ignore-installed --break-system-packages . && \ rm -rf /install && \ rm -rf /root/.cache && \ apt remove -y git build-essential && \ diff --git a/platypush/install/docker/fedora.Dockerfile b/platypush/install/docker/fedora.Dockerfile index 67e46801aa..7b56c8ffff 100644 --- a/platypush/install/docker/fedora.Dockerfile +++ b/platypush/install/docker/fedora.Dockerfile @@ -19,7 +19,7 @@ RUN --mount=type=bind,source=.,target=/curdir \ RUN /install/platypush/install/scripts/fedora/install.sh && \ cd /install && \ - pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \ + pip install -U --no-input --no-cache-dir --no-deps --ignore-installed --break-system-packages . && \ rm -rf /install && \ rm -rf /root/.cache && \ dnf remove -y build-essential git && \ diff --git a/platypush/install/docker/ubuntu.Dockerfile b/platypush/install/docker/ubuntu.Dockerfile index 1442e8ba0c..e79e3b7e39 100644 --- a/platypush/install/docker/ubuntu.Dockerfile +++ b/platypush/install/docker/ubuntu.Dockerfile @@ -21,7 +21,7 @@ RUN --mount=type=bind,source=.,target=/curdir \ RUN /install/platypush/install/scripts/debian/install.sh && \ cd /install && \ - pip install -U --no-input --no-cache-dir --no-deps . --break-system-packages && \ + pip install -U --no-input --no-cache-dir --no-deps --ignore-installed --break-system-packages . && \ rm -rf /install && \ rm -rf /root/.cache && \ apt remove -y git \ diff --git a/platypush/utils/manifest.py b/platypush/utils/manifest.py index 1d0ff533cc..e864c3af0d 100644 --- a/platypush/utils/manifest.py +++ b/platypush/utils/manifest.py @@ -475,6 +475,7 @@ class Dependencies: yield ( 'pip install -U --no-input ' + ('--no-cache-dir ' if self._is_docker else '') + + ('--ignore-installed ' if not self._is_venv else '') + ( '--break-system-packages ' if wants_break_system_packages