Skip to content

Commit 43a6e4f

Browse files
miss-islingtonambv
andauthored
[3.9] gh-109002: Ensure only one wheel for each vendored package (GH-109003) (#109008)
Output with one wheel: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py Verifying checksum for /Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl. Expected digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be Actual digest: 7ccf472345f20d35bdc9d1841ff5f313260c2c33fe417f48c30ac46cccabf5be ::notice file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Successfully verified the checksum of the pip wheel. ``` Output with two wheels: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py ::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-22.0.4-py3-none-any.whl::Found more than one wheel for package pip. ::error file=/Volumes/RAMDisk/cpython/Lib/ensurepip/_bundled/pip-23.2.1-py3-none-any.whl::Found more than one wheel for package pip. ``` Output without wheels: ``` ❯ GITHUB_ACTIONS=true ./Tools/build/verify_ensurepip_wheels.py ::error file=::Could not find a pip wheel on disk. ``` (cherry picked from commit f8a0479) Co-authored-by: Łukasz Langa <[email protected]>
1 parent 13905c9 commit 43a6e4f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Tools/scripts/verify_ensurepip_wheels.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python3
1+
#!/usr/bin/env python3
22

33
"""
44
Compare checksums for wheels in :mod:`ensurepip` against the Cheeseshop.
@@ -35,11 +35,17 @@ def print_error(file_path: str, message: str) -> None:
3535

3636
def verify_wheel(package_name: str) -> bool:
3737
# Find the package on disk
38-
package_path = next(WHEEL_DIR.glob(f"{package_name}*.whl"), None)
39-
if not package_path:
40-
print_error("", f"Could not find a {package_name} wheel on disk.")
38+
package_paths = list(WHEEL_DIR.glob(f"{package_name}*.whl"))
39+
if len(package_paths) != 1:
40+
if package_paths:
41+
for p in package_paths:
42+
print_error(p, f"Found more than one wheel for package {package_name}.")
43+
else:
44+
print_error("", f"Could not find a {package_name} wheel on disk.")
4145
return False
4246

47+
package_path = package_paths[0]
48+
4349
print(f"Verifying checksum for {package_path}.")
4450

4551
# Find the version of the package used by ensurepip

0 commit comments

Comments
 (0)