download cpython installer to cache dir on macos (#2108)

* cache cpython install on macos

* Update cibuildwheel/macos.py

Co-authored-by: Joe Rickerby <joerick@mac.com>

---------

Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
Trim21
2025-01-10 15:28:35 +00:00
committed by GitHub
co-authored by Joe Rickerby
parent 6a3c9552c5
commit 66295e07b9
+5 -5
View File
@@ -139,7 +139,7 @@ def get_python_configurations(
return 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 "" ft = "T" if free_threading else ""
installation_path = Path(f"/Library/Frameworks/Python{ft}.framework/Versions/{version}") installation_path = Path(f"/Library/Frameworks/Python{ft}.framework/Versions/{version}")
with FileLock(CIBW_CACHE_PATH / f"cpython{version}.lock"): 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) raise errors.FatalError(msg)
pkg_path = tmp / "Python.pkg" python_filename = url.split("/")[-1]
# download the pkg pkg_path = CIBW_CACHE_PATH / "cpython-installer" / python_filename
download(url, pkg_path) if not pkg_path.exists():
# install download(url, pkg_path)
args = [] args = []
if version.startswith("3.13"): if version.startswith("3.13"):
# Python 3.13 is the first version to have a free-threading option # Python 3.13 is the first version to have a free-threading option