The implementation of the "package" command.
(context: argparse.Namespace)
| 702 | |
| 703 | |
| 704 | def package(context: argparse.Namespace) -> None: |
| 705 | """The implementation of the "package" command.""" |
| 706 | if context.clean: |
| 707 | clean(context, "package") |
| 708 | |
| 709 | with group("Building package"): |
| 710 | # Create an XCframework |
| 711 | version = create_xcframework(context.platform) |
| 712 | |
| 713 | # Clone testbed |
| 714 | print() |
| 715 | run([ |
| 716 | sys.executable, |
| 717 | "Platforms/Apple/testbed", |
| 718 | "clone", |
| 719 | "--platform", |
| 720 | context.platform, |
| 721 | "--framework", |
| 722 | CROSS_BUILD_DIR / context.platform / "Python.xcframework", |
| 723 | CROSS_BUILD_DIR / context.platform / "testbed", |
| 724 | ]) |
| 725 | |
| 726 | # Build the final archive |
| 727 | archive_name = ( |
| 728 | CROSS_BUILD_DIR |
| 729 | / "dist" |
| 730 | / f"python-{version}-{context.platform}-XCframework" |
| 731 | ) |
| 732 | |
| 733 | print() |
| 734 | print("Create package archive...") |
| 735 | shutil.make_archive( |
| 736 | str(CROSS_BUILD_DIR / archive_name), |
| 737 | format="gztar", |
| 738 | root_dir=CROSS_BUILD_DIR / context.platform, |
| 739 | base_dir=".", |
| 740 | ) |
| 741 | print() |
| 742 | print(f"{archive_name.relative_to(PYTHON_DIR)}.tar.gz created.") |
| 743 | |
| 744 | |
| 745 | def build(context: argparse.Namespace, host: str | None = None) -> None: |
no test coverage detected
searching dependent graphs…