Skip to content

Commit

Permalink
fix: unpin pipx in requirements-base-tools.in (#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed May 12, 2024
1 parent 7415d48 commit 37b0e30
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
5 changes: 5 additions & 0 deletions docker/build_scripts/finalize-one.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ PY_VER=$(${PREFIX}/bin/python -c "import sys; print('.'.join(str(v) for v in sys
PY_IMPL=$(${PREFIX}/bin/python -c "import sys; print(sys.implementation.name)")
PY_GIL=$(${PREFIX}/bin/python -c "import sysconfig; print('t' if sysconfig.get_config_vars().get('Py_GIL_DISABLED', 0) else '')")

# disable some pip warnings
export PIP_ROOT_USER_ACTION=ignore
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_NO_WARN_SCRIPT_LOCATION=0

# Install pinned packages for this python version.
# Use the already intsalled cpython pip to bootstrap pip if available
if [ -f /usr/local/bin/python${PY_VER} ]; then
Expand Down
19 changes: 14 additions & 5 deletions docker/build_scripts/finalize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ XZ_OPT=-9e tar -cJf static-libs-for-embedding-only.tar.xz cpython-*/lib/libpytho
popd
find /opt/_internal -name '*.a' -print0 | xargs -0 rm -f

# disable some pip warnings
export PIP_ROOT_USER_ACTION=ignore
export PIP_DISABLE_PIP_VERSION_CHECK=1
export PIP_NO_WARN_SCRIPT_LOCATION=0
# all cache goes to /tmp
export PIP_CACHE_DIR=/tmp/pip_cache

# update package, create symlinks for each python
mkdir /opt/python
for PREFIX in $(find /opt/_internal/ -mindepth 1 -maxdepth 1 \( -name 'cpython*' -o -name 'pypy*' \)); do
Expand Down Expand Up @@ -51,6 +58,7 @@ set -euo pipefail
if [ \$(id -u) -eq 0 ]; then
export PIPX_HOME=/opt/_internal/pipx
export PIPX_BIN_DIR=/usr/local/bin
export PIPX_MAN_DIR=/usr/local/share/man
fi
${TOOLS_PATH}/bin/pipx "\$@"
EOF
Expand All @@ -64,19 +72,20 @@ ln -s $(${TOOLS_PATH}/bin/python -c 'import certifi; print(certifi.where())') /o
# If you modify this line you also have to modify the versions in the Dockerfiles:
export SSL_CERT_FILE=/opt/_internal/certs.pem

# initialize shared library, pip is not pinned in pipx
pipx install pip
pipx uninstall pip

# install other tools with pipx
pushd $MY_DIR/requirements-tools
for TOOL_PATH in $(find . -type f); do
for TOOL_PATH in $(find ${MY_DIR}/requirements-tools -type f); do
TOOL=$(basename ${TOOL_PATH})
pipx install --pip-args="--require-hashes -r" ${TOOL}
pipx install --pip-args="--require-hashes -r ${TOOL_PATH} --only-binary" ${TOOL}
done
popd

# We do not need the precompiled .pyc and .pyo files.
clean_pyc /opt/_internal

# remove cache
rm -rf /root/.cache
rm -rf /tmp/* || true

hardlink -cv /opt/_internal
Expand Down
6 changes: 3 additions & 3 deletions docker/build_scripts/requirements-base-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ packaging==24.0 \
--hash=sha256:2ddfb553fdf02fb784c234c7ba6ccc288296ceabec964ad2eae3777778130bc5 \
--hash=sha256:eb82c5e3e56209074766e6885bb04b8c38a0c015d0a30036ebe7ece34c9989e9
# via pipx
pipx==1.4.3 \
--hash=sha256:aa25c7a7d455daed7597bb88c259389176680e2e7446fbdb6e6696cdd3a5090b \
--hash=sha256:d214512bccc601b575de096ee84fde8797323717a20752c48f7a55cc1bf062fe
pipx==1.5.0 \
--hash=sha256:2371af2b772954cdb5c1dbfa0170219e3d2c09d9ff9b18e975f65562eeb7ab0a \
--hash=sha256:801a55a9d58004bb18a464f668508e79fbffc22deb6f07982832d3ce3ff3756d
platformdirs==4.2.1 \
--hash=sha256:031cd18d4ec63ec53e82dceaac0417d218a6863f7745dfcc9efe7793b7039bdf \
--hash=sha256:17d5a1161b3fd67b390023cb2d3b026bbd40abde6fdb052dfbd3a29c3ba22ee1
Expand Down
2 changes: 1 addition & 1 deletion requirements-base-tools.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
certifi
pipx<1.5.0
pipx

0 comments on commit 37b0e30

Please sign in to comment.