Skip to content

Commit e6d93bc

Browse files
committed
build(python): switch to pipx for better virtual env isolation
1 parent 5731942 commit e6d93bc

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

aws-cli/Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,28 @@ RUN dnf upgrade -y \
3737
xz-5.2.5-9.amzn2023.0.2 \
3838
zip-3.0-28.amzn2023.0.2 \
3939
&& IFS=$'\n\t' \
40-
&& if dnf upgrade -y | grep -v -e '^Nothing to do.' ; then \
40+
&& if dnf upgrade -y | tee >(cat 1>&2) | grep -q -e '^Nothing to do.' ; then \
4141
exit 1 ; \
4242
fi \
4343
&& dnf clean all \
4444
&& rm -rf /var/cache/yum
4545

46-
# @TL FIXME: --break-system-packages not supported until Python 3.11.
46+
# FIXME @TL workaround until Amazon Linux gets a pipx package
47+
# FIXME @TL --break-system-packages not supported until Python 3.11.
4748
RUN pip3 install --no-cache-dir --upgrade \
49+
pipx==1.7.1 \
50+
&& pip3 list --outdated | tee >(cat 1>&2) | grep -q -e '^pipx ' ; then \
51+
exit 1 ; \
52+
fi
53+
54+
RUN pipx ensurepath --global \
55+
&& pipx install --global \
4856
cfn-policy-validator==0.0.36 \
4957
json2yaml==1.2.0 \
5058
yamlpath==3.8.2 \
5159
yq==3.4.3 \
52-
&& IFS=$'\n\t' \
53-
&& msg="$(pip3 list --outdated | grep -i -e '^cfn-policy-validator ' || true)" \
54-
&& if [ -n "${msg}" ]; then \
55-
>&2 echo "ERROR: outdated: ${msg}" ; \
60+
&& if pipx upgrade-all --global | grep -q -e . ; then \
61+
pipx upgrade-all --global ; \
5662
exit 1 ; \
5763
fi
5864

aws-cli/docker-compose.test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ services:
2626
patch --version # patch
2727
ping -V # iputils
2828
pip --version # py3-pip
29+
pipx --version # pipx
2930
python --version # python3
3031
rsync --version # rsync
3132
sed --version # sed

0 commit comments

Comments
 (0)