From eec7b3da5cf61e28a9f68f81f63992a19beaf823 Mon Sep 17 00:00:00 2001 From: trim21 Date: Sat, 7 Dec 2024 23:53:48 +0800 Subject: [PATCH] cache cpython install on macos --- cibuildwheel/macos.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index fcc88dac9..fe292c881 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.joinpath("python", 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