(context)
| 760 | |
| 761 | |
| 762 | def package(context): |
| 763 | prefix_dir = subdir(context.host, "prefix") |
| 764 | version = package_version(prefix_dir) |
| 765 | |
| 766 | with TemporaryDirectory(prefix=SCRIPT_NAME) as temp_dir: |
| 767 | temp_dir = Path(temp_dir) |
| 768 | |
| 769 | # Include all tracked files from the Android directory. |
| 770 | for line in run( |
| 771 | ["git", "ls-files"], |
| 772 | cwd=ANDROID_DIR, capture_output=True, text=True, log=False, |
| 773 | ).stdout.splitlines(): |
| 774 | src = ANDROID_DIR / line |
| 775 | dst = temp_dir / line |
| 776 | dst.parent.mkdir(parents=True, exist_ok=True) |
| 777 | shutil.copy2(src, dst, follow_symlinks=False) |
| 778 | |
| 779 | # Include anything from the prefix directory which could be useful |
| 780 | # either for embedding Python in an app, or building third-party |
| 781 | # packages against it. |
| 782 | for rel_dir, patterns in [ |
| 783 | ("include", ["openssl*", "python*", "sqlite*"]), |
| 784 | ("lib", ["engines-3", "libcrypto*.so", "libpython*", "libsqlite*", |
| 785 | "libssl*.so", "ossl-modules", "python*"]), |
| 786 | ("lib/pkgconfig", ["*crypto*", "*ssl*", "*python*", "*sqlite*"]), |
| 787 | ]: |
| 788 | for pattern in patterns: |
| 789 | for src in glob(f"{prefix_dir}/{rel_dir}/{pattern}"): |
| 790 | dst = temp_dir / relpath(src, prefix_dir.parent) |
| 791 | dst.parent.mkdir(parents=True, exist_ok=True) |
| 792 | if Path(src).is_dir(): |
| 793 | shutil.copytree( |
| 794 | src, dst, symlinks=True, |
| 795 | ignore=lambda *args: ["__pycache__"] |
| 796 | ) |
| 797 | else: |
| 798 | shutil.copy2(src, dst, follow_symlinks=False) |
| 799 | |
| 800 | # Strip debug information. |
| 801 | if not context.debug: |
| 802 | so_files = glob(f"{temp_dir}/**/*.so", recursive=True) |
| 803 | run([android_env(context.host)["STRIP"], *so_files], log=False) |
| 804 | |
| 805 | dist_dir = subdir(context.host, "dist", create=True) |
| 806 | package_path = shutil.make_archive( |
| 807 | f"{dist_dir}/python-{version}-{context.host}", "gztar", temp_dir |
| 808 | ) |
| 809 | print(f"Wrote {package_path}") |
| 810 | return package_path |
| 811 | |
| 812 | |
| 813 | def ci(context): |
nothing calls this directly
no test coverage detected
searching dependent graphs…