fix: error out if multiple wheels with the same name are produced

We shouldn't silently overwrite wheels that are produced in the same run that have the same filename, as this implies a misconfiguration.
This commit is contained in:
mayeut
2022-06-26 11:32:33 +02:00
parent 0696c94710
commit ef18186c45
5 changed files with 69 additions and 0 deletions
+14
View File
@@ -373,6 +373,20 @@ class NonPlatformWheelError(Exception):
super().__init__(message)
class AlreadyBuiltWheelError(Exception):
def __init__(self, wheel_name: str) -> None:
message = textwrap.dedent(
f"""
cibuildwheel: Build failed because a wheel named {wheel_name} was already generated in the current run.
If you expected another wheel to be generated, check your project configuration, or run
cibuildwheel with CIBW_BUILD_VERBOSITY=1 to view build logs.
"""
)
super().__init__(message)
def strtobool(val: str) -> bool:
return val.lower() in {"y", "yes", "t", "true", "on", "1"}