Skip to content

Commit a6c0321

Browse files
committed
Add check-ensurepip tool
Signed-off-by: Michał Górny <[email protected]>
1 parent f5ab662 commit a6c0321

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

README.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,13 @@ to dev.gentoo.org. Typical usage::
115115
# tag archive-name upstream dgo-subdir
116116
mkpatchset gentoo-3.9.8 python-gentoo-patches-3.9.8 v3.9.8 python/
117117

118+
check-ensurepip
119+
---------------
120+
Dependencies: git, pkgcore
121+
122+
Check whether ``dev-python/ensurepip-*`` packages are up-to-date.
123+
Useful for a pre-push hook.
124+
118125

119126
Package tree iteration helpers
120127
==============================

check-ensurepip

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
# check whether ensurepip-* packages are up-to-date
3+
4+
REPO=$(git rev-parse --show-toplevel)
5+
PKGS=( pip setuptools )
6+
7+
declare -A VERSIONS
8+
while read -r PKG; do
9+
PKG=${PKG#dev-python/}
10+
NAME=${PKG%-*}
11+
VERSION=${PKG##*-}
12+
VERSIONS[${NAME}]=${VERSION}
13+
done < <(
14+
pquery -q -r "${REPO}" --max "${PKGS[@]/#/dev-python\/}" \
15+
"${PKGS[@]/#/dev-python\/ensurepip-}"
16+
)
17+
18+
for PKG in "${PKGS[@]}"; do
19+
ENSUREPIP="${VERSIONS[ensurepip-${PKG}]}"
20+
ACTUAL="${VERSIONS[${PKG}]}"
21+
22+
if [[ ${ENSUREPIP} != ${ACTUAL} ]]; then
23+
echo "Ensurepip mismatch found!" >&2
24+
echo " dev-python/ensurepip-${PKG}: ${ENSUREPIP}" >&2
25+
echo " dev-python/${PKG}: ${ACTUAL}" >&2
26+
fi
27+
done

0 commit comments

Comments
 (0)