Unpack binary dependencies into a provided directory. Downloads binaries if they aren't already present. Downloads will be stored in provided cache directory. On iOS, as a safety mechanism, any dynamic libraries will be purged from the unpacked dependencies.
(
platform: str,
host: str,
prefix_dir: Path,
cache_dir: Path,
)
| 295 | |
| 296 | |
| 297 | def unpack_deps( |
| 298 | platform: str, |
| 299 | host: str, |
| 300 | prefix_dir: Path, |
| 301 | cache_dir: Path, |
| 302 | ) -> None: |
| 303 | """Unpack binary dependencies into a provided directory. |
| 304 | |
| 305 | Downloads binaries if they aren't already present. Downloads will be stored |
| 306 | in provided cache directory. |
| 307 | |
| 308 | On iOS, as a safety mechanism, any dynamic libraries will be purged from |
| 309 | the unpacked dependencies. |
| 310 | """ |
| 311 | # To create new builds of these dependencies, usually all that's necessary |
| 312 | # is to push a tag to the cpython-apple-source-deps repository, and GitHub |
| 313 | # Actions will do the rest. |
| 314 | # |
| 315 | # If you're a member of the Python core team, and you'd like to be able to |
| 316 | # push these tags yourself, please contact Malcolm Smith or Russell |
| 317 | # Keith-Magee. |
| 318 | deps_url = "https://github.com/beeware/cpython-apple-source-deps/releases/download" |
| 319 | for name_ver in [ |
| 320 | "BZip2-1.0.8-2", |
| 321 | "libFFI-3.4.7-2", |
| 322 | "OpenSSL-3.5.5-1", |
| 323 | "XZ-5.6.4-2", |
| 324 | "mpdecimal-4.0.0-2", |
| 325 | "zstd-1.5.7-1", |
| 326 | ]: |
| 327 | filename = f"{name_ver.lower()}-{apple_target(host)}.tar.gz" |
| 328 | archive_path = download( |
| 329 | f"{deps_url}/{name_ver}/{filename}", |
| 330 | target_dir=cache_dir, |
| 331 | ) |
| 332 | shutil.unpack_archive(archive_path, prefix_dir) |
| 333 | |
| 334 | # Dynamic libraries will be preferentially linked over static; |
| 335 | # On iOS, ensure that no dylibs are available in the prefix folder. |
| 336 | if platform == "iOS": |
| 337 | for dylib in prefix_dir.glob("**/*.dylib"): |
| 338 | dylib.unlink() |
| 339 | |
| 340 | |
| 341 | def download(url: str, target_dir: Path) -> Path: |
no test coverage detected
searching dependent graphs…