fix: overwriting wheel on windows shouldn't break (#1464)

fix overwriting wheel on windows

This is the same fix as #1129 but for Windows this time.
This commit is contained in:
David Lechner
2023-04-17 14:06:14 -04:00
committed by GitHub
parent 7c9b837780
commit fa72100d49
+4
View File
@@ -7,6 +7,7 @@ import subprocess
import sys import sys
import textwrap import textwrap
from collections.abc import Set from collections.abc import Set
from contextlib import suppress
from dataclasses import dataclass from dataclasses import dataclass
from functools import lru_cache from functools import lru_cache
from pathlib import Path from pathlib import Path
@@ -560,6 +561,9 @@ def build(options: Options, tmp_path: Path) -> None:
# we're all done here; move it to output (remove if already exists) # we're all done here; move it to output (remove if already exists)
if compatible_wheel is None: if compatible_wheel is None:
with suppress(FileNotFoundError):
(build_options.output_dir / repaired_wheel.name).unlink()
shutil.move(str(repaired_wheel), build_options.output_dir) shutil.move(str(repaired_wheel), build_options.output_dir)
built_wheels.append(build_options.output_dir / repaired_wheel.name) built_wheels.append(build_options.output_dir / repaired_wheel.name)