MCPcopy Index your code
hub / github.com/python/cpython / package

Function package

Platforms/Apple/__main__.py:704–742  ·  view source on GitHub ↗

The implementation of the "package" command.

(context: argparse.Namespace)

Source from the content-addressed store, hash-verified

702
703
704def 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
745def build(context: argparse.Namespace, host: str | None = None) -> None:

Callers 1

buildFunction · 0.70

Calls 7

create_xcframeworkFunction · 0.85
strFunction · 0.85
make_archiveMethod · 0.80
cleanFunction · 0.70
groupFunction · 0.70
runFunction · 0.70
relative_toMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…