From 94c2ff30919d5f9dd89e35fe1c1b3f401916cb45 Mon Sep 17 00:00:00 2001 From: mikeeq Date: Thu, 19 Dec 2024 01:05:39 +0100 Subject: [PATCH] add pipx force --- Dockerfile | 14 +++++++------- Dockerfile-ubuntu | 14 ++++++++------ roles/pkg_mgmt/pip/tasks/main.yml | 2 ++ 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9a203faa..914fd976 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,7 @@ RUN dnf clean all \ && dnf install -y \ python3-pip \ systemd \ + pipx \ ShellCheck \ && dnf clean all @@ -28,18 +29,17 @@ rm -f /lib/systemd/system/basic.target.wants/*; \ rm -f /lib/systemd/system/anaconda.target.wants/*; # https://pypi.org/project/pip/ -RUN pip3 install --no-cache-dir --upgrade pip==24.3.1 && \ - pip3 install --no-cache-dir \ +RUN pipx install --global --force --include-deps \ # https://pypi.org/project/ansible/ - ansible==10.5.0 \ + ansible \ # https://pypi.org/project/ansible-lint/ - ansible-lint==24.9.2 \ + ansible-lint \ # https://pypi.org/project/yamllint/ - yamllint==1.35.1 \ + yamllint \ # https://pypi.org/project/packaging/ - packaging==24.1 \ + packaging \ # https://pypi.org/project/pyOpenSSL/ - pyOpenSSL==24.2.1 + pyOpenSSL # Dive RUN curl -LO https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.tar.gz && \ diff --git a/Dockerfile-ubuntu b/Dockerfile-ubuntu index 556c9203..48cf9cfb 100644 --- a/Dockerfile-ubuntu +++ b/Dockerfile-ubuntu @@ -8,23 +8,25 @@ RUN apt-get update \ && apt-get upgrade -y \ && apt-get install -y \ python3-pip \ + pipx \ sudo \ && apt-get clean all # https://pypi.org/project/pip/ # rm -rfv /usr/lib/*/EXTERNALLY-MANAGED # RUN pip3 install --break-system-packages --no-cache-dir --upgrade pip==24.3.1 && \ -RUN pip3 install --break-system-packages --no-cache-dir \ +# https://pypi.org/project/pip/ +RUN pipx install --global --force --include-deps \ # https://pypi.org/project/ansible/ - ansible==10.5.0 \ + ansible \ # https://pypi.org/project/ansible-lint/ - ansible-lint==24.9.2 \ + ansible-lint \ # https://pypi.org/project/yamllint/ - yamllint==1.35.1 \ + yamllint \ # https://pypi.org/project/packaging/ - packaging==24.1 \ + packaging \ # https://pypi.org/project/pyOpenSSL/ - pyOpenSSL==24.2.1 + pyOpenSSL RUN useradd ${UBUNTU_USERNAME} && usermod -aG sudo ${UBUNTU_USERNAME} diff --git a/roles/pkg_mgmt/pip/tasks/main.yml b/roles/pkg_mgmt/pip/tasks/main.yml index e773bcdc..442e9719 100644 --- a/roles/pkg_mgmt/pip/tasks/main.yml +++ b/roles/pkg_mgmt/pip/tasks/main.yml @@ -51,6 +51,7 @@ install_deps: true global: true python: "{{ item.python_version | default(omit) }}" + force: true with_items: - "{{ pipx_apps }}" @@ -63,6 +64,7 @@ python: "{{ item.python_version | default(omit) }}" install_apps: true inject_packages: "{{ item.inject_packages | default(omit) }}" + force: true when: item.inject_packages is defined with_items: - "{{ pipx_apps }}"