Skip to content

Commit

Permalink
Fix remove_local_wheels for no build wheels (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Nov 9, 2024
1 parent 6fd5b40 commit 8bd39cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builder/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,6 @@ def remove_local_wheels(
for binary in exists:
version = binary_package_map[binary]
print(f"Found existing wheels for {binary}, removing local copy {version}")
for wheel in wheel_map[binary]:
for wheel in wheel_map.get(binary, ()):
print(f"Removing local wheel {wheel}")
wheel.unlink()
15 changes: 15 additions & 0 deletions tests/test_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,18 @@ def test_remove_local_wheel_normalized_package_names(tmppath: Path) -> None:

# grpcio and google-cloud-pubsub are removed
assert {p.name for p in tmppath.glob("*.whl")} == set()


def test_remove_local_wheel_no_build_wheels(tmppath: Path) -> None:
"""Test remove_local_wheels does not fail with skip_exists and no build wheels."""
package_index = infra.extract_packages_from_index("https://example.com")
assert {p.name for p in tmppath.glob("*.whl")} == set()

infra.remove_local_wheels(
package_index,
skip_exists="grpcio",
packages=[
"grpcio==1.31.0", # Exists in index
],
wheels_dir=tmppath,
)

0 comments on commit 8bd39cb

Please sign in to comment.