Improve error message when no matching wheel is found (#2284)

This commit is contained in:
Hood Chatham 2022-03-17 20:22:17 -07:00 committed by GitHub
parent 0e1e2ac01c
commit 25358e4f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -103,12 +103,12 @@ class Package(BasePackage):
def wheel_path(self) -> Path: def wheel_path(self) -> Path:
dist_dir = self.pkgdir / "dist" dist_dir = self.pkgdir / "dist"
wheel, *rest = find_matching_wheels(dist_dir.glob("*.whl")) wheels = list(find_matching_wheels(dist_dir.glob("*.whl")))
if rest: if len(wheels) != 1:
raise Exception( raise Exception(
f"Unexpected number of wheels {len(rest) + 1} when building {self.name}" f"Unexpected number of wheels {len(wheels)} when building {self.name}"
) )
return wheel return wheels[0]
def tests_path(self) -> Optional[Path]: def tests_path(self) -> Optional[Path]:
tests = list((self.pkgdir / "dist").glob("*-tests.tar")) tests = list((self.pkgdir / "dist").glob("*-tests.tar"))