Skip to content

Commit 5e80406

Browse files
committed
fix(python): tidy shims
1 parent 7065dd8 commit 5e80406

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

python/3/Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ARG DEBIAN_FRONTEND=noninteractive
1515
RUN set -eux; \
1616
apt-get update; \
1717
apt-get install -y --no-install-recommends \
18-
python3.11 python3-pip python3.11-venv; \
18+
python3.11 python3.11-venv python3-pip; \
1919
apt-get clean; \
2020
rm -rf /var/lib/apt/lists/*
2121

@@ -27,8 +27,11 @@ COPY --from=py310 /usr/local/bin/ /usr/local/bin/
2727
COPY --from=py312 /usr/local/lib/ /usr/local/lib/
2828
COPY --from=py312 /usr/local/bin/ /usr/local/bin/
2929

30-
# Make explicit version shims available in /usr/bin
31-
RUN ln -sf /usr/local/bin/python3.10 /usr/bin/python3.10 && \
32-
ln -sf /usr/local/bin/python3.12 /usr/bin/python3.12 && \
33-
ln -sf /usr/local/bin/pip3.10 /usr/bin/pip3.10 && \
34-
ln -sf /usr/local/bin/pip3.12 /usr/bin/pip3.12
30+
# Make explicit version shims available in /usr/bin, and remove conflicting shims in /usr/local/bin
31+
RUN set -eux; \
32+
for shim in python3.10 python3.12 pip3.10 pip3.12; do \
33+
ln -sf "/usr/local/bin/$shim" "/usr/bin/$shim"; \
34+
done; \
35+
for shim in pip pip3 idle3 pydoc3 2to3 python-config python3-config; do \
36+
rm -f "/usr/local/bin/$shim"; \
37+
done

0 commit comments

Comments
 (0)