File tree 3 files changed +64
-51
lines changed
3 files changed +64
-51
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ name : Verify bundled pip and setuptools
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ push :
6
+ paths :
7
+ - ' Lib/ensurepip/_bundled/**'
8
+ pull_request :
9
+ paths :
10
+ - ' Lib/ensurepip/_bundled/**'
11
+
12
+ jobs :
13
+ verify :
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - uses : actions/checkout@v3
17
+ - name : Compare checksums of bundled pip and setuptools to ones published on PyPI
18
+ run : ./Misc/verify-bundled-wheels.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ #
4
+ # Purpose: Compare checksums of bundled pip and setuptools to ones
5
+ # published on PyPI (retrieved via the Warehouse’s JSON API).
6
+ #
7
+ # Synopsis: ./Misc/verify-bundled-wheels.sh
8
+ #
9
+ # Requirements: curl, jq
10
+ #
11
+
12
+ cd " $( dirname " $0 " ) /.."
13
+ package_names=" pip setuptools"
14
+ exit_status=0
15
+
16
+ for package_name in ${package_names} ; do
17
+ package_path=$( find Lib/ensurepip/_bundled/ -name " ${package_name} *.whl" )
18
+ echo " $package_path "
19
+
20
+ package_name_uppercase=$( echo " $package_name " | tr " [:lower:]" " [:upper:]" )
21
+ package_version=$(
22
+ grep -Pom 1 " _${package_name_uppercase} _VERSION = \" \K[^\" ]+" Lib/ensurepip/__init__.py
23
+ )
24
+ expected_digest=$( curl -fs " https://pypi.org/pypi/${package_name} /json" | jq --raw-output "
25
+ .releases.\" ${package_version} \"
26
+ | .[]
27
+ | select(.filename == \" $( basename " $package_path " ) \" )
28
+ | .digests.sha256
29
+ " )
30
+ echo " Expected digest: ${expected_digest} "
31
+
32
+ actual_digest=$( sha256sum " $package_path " | awk ' {print $1}' )
33
+ echo " Actual digest:\t ${actual_digest} "
34
+
35
+ # The messages are formatted to be parsed by GitHub Actions.
36
+ # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-notice-message
37
+ if [ " $actual_digest " = " $expected_digest " ]; then
38
+ echo " ::notice file=${package_path} ::Successfully verified checksum of this wheel."
39
+ else
40
+ echo " ::error file=${package_path} ::Failed to verify checksum of this wheel."
41
+ exit_status=1
42
+ fi
43
+ echo
44
+ done
45
+
46
+ exit $exit_status
You can’t perform that action at this time.
0 commit comments