fix: avoid races in filesystem ops (#2287)

Use `exist_ok` and `missing_ok` in pathlib operations where we can.
This commit is contained in:
Lehman Garrison
2025-02-26 10:56:35 -05:00
committed by GitHub
parent 4d37797aa6
commit 88ef8dbd29
4 changed files with 4 additions and 8 deletions
+1 -2
View File
@@ -399,8 +399,7 @@ def build_in_directory(args: CommandLineArguments) -> None:
output_dir = options.globals.output_dir
if not output_dir.exists():
output_dir.mkdir(parents=True)
output_dir.mkdir(parents=True, exist_ok=True)
tmp_path = Path(mkdtemp(prefix="cibw-run-")).resolve(strict=True)
try:
+1 -2
View File
@@ -25,8 +25,7 @@ CIBW_CACHE_PATH: Final[Path] = Path(
def download(url: str, dest: Path) -> None:
print(f"+ Download {url} to {dest}")
dest_dir = dest.parent
if not dest_dir.exists():
dest_dir.mkdir(parents=True)
dest_dir.mkdir(parents=True, exist_ok=True)
# we've had issues when relying on the host OS' CA certificates on Windows,
# so we use certifi (this sounds odd but requests also does this by default)