From 66295e07b99be4f9fc11f8e06ce4144ff2fa5ccb Mon Sep 17 00:00:00 2001 From: Trim21 Date: Fri, 10 Jan 2025 23:28:35 +0800 Subject: [PATCH] download cpython installer to cache dir on macos (#2108) * cache cpython install on macos * Update cibuildwheel/macos.py Co-authored-by: Joe Rickerby --------- Co-authored-by: Joe Rickerby --- cibuildwheel/macos.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index 357baa84..dc291973 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -139,7 +139,7 @@ def get_python_configurations( return python_configurations -def install_cpython(tmp: Path, version: str, url: str, free_threading: bool) -> Path: +def install_cpython(_tmp: Path, version: str, url: str, free_threading: bool) -> Path: ft = "T" if free_threading else "" installation_path = Path(f"/Library/Frameworks/Python{ft}.framework/Versions/{version}") with FileLock(CIBW_CACHE_PATH / f"cpython{version}.lock"): @@ -161,10 +161,10 @@ def install_cpython(tmp: Path, version: str, url: str, free_threading: bool) -> """ ) raise errors.FatalError(msg) - pkg_path = tmp / "Python.pkg" - # download the pkg - download(url, pkg_path) - # install + python_filename = url.split("/")[-1] + pkg_path = CIBW_CACHE_PATH / "cpython-installer" / python_filename + if not pkg_path.exists(): + download(url, pkg_path) args = [] if version.startswith("3.13"): # Python 3.13 is the first version to have a free-threading option