Skip to content

Commit 09b5eaf

Browse files
CopilotSkn0tt
andauthored
fix(setup): resolve tempfile.tempdir for auditwheel 6.3.0 on macOS
Agent-Logs-Url: https://github.com/microsoft/playwright-python/sessions/1a8a3424-455a-40cd-85d7-7df3750e3334 Co-authored-by: Skn0tt <14912729+Skn0tt@users.noreply.github.com>
1 parent f223264 commit 09b5eaf

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

setup.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@
1818
import shutil
1919
import subprocess
2020
import sys
21+
import tempfile
2122
import zipfile
2223
from pathlib import Path
2324
from typing import Dict
2425

26+
# auditwheel 6.3.0's InWheel uses tempfile.TemporaryDirectory for its bdist_dir,
27+
# but its rewrite_record helper walks files via Path.resolve(strict=True). On
28+
# macOS (and any system whose tempdir traverses a symlink, e.g. /var ->
29+
# /private/var) the walked paths don't share a prefix with bdist_dir, causing
30+
# Path.relative_to() to fail. Resolve the tempdir up front so both sides match.
31+
tempfile.tempdir = str(Path(tempfile.gettempdir()).resolve())
32+
2533
driver_version = "1.59.1"
2634

2735
base_wheel_bundles = [
@@ -177,10 +185,7 @@ def _build_wheel(
177185
if InWheel:
178186
wheelhouse_whl = os.path.join("wheelhouse", os.path.basename(whlfile))
179187
shutil.move(whlfile, wheelhouse_whl)
180-
with InWheel(
181-
in_wheel=Path(wheelhouse_whl).resolve(),
182-
out_wheel=Path(whlfile).resolve(),
183-
):
188+
with InWheel(in_wheel=Path(wheelhouse_whl), out_wheel=Path(whlfile)):
184189
print(f"Updating RECORD file of {whlfile}")
185190
print("Copying new wheels")
186191
shutil.rmtree("wheelhouse")

0 commit comments

Comments
 (0)