Android build updated from Chaquopy#2
Merged
FeodorFitsner merged 6 commits intopython-3.12from Dec 5, 2024
Merged
Conversation
FeodorFitsner
added a commit
that referenced
this pull request
Feb 23, 2026
* Enable _sqlite3 * Add libc++_shared.so to Android distro * Fix NDK path to libc++_shared.so * Android build updated from Chaquopy (#2) * Android build is in sync with Chaquopy * Python 3.12.7 * Fix downloads dir * Fix deps downloads * Android NDK r27c (27.2.12479018) * Re-build Python for iOS with xcrun fix * Include libssl and libcrypto to macOS framework bundle * Python 3.12.8 and back to beeware/Python-Apple-support * MinimumOSVersion=13.0 * Fix Windows build * Exclude ctypes/macholib/fetch_macholib from iOS distro * Python 3.12.9 * Update path in .origin * Add PrivacyInfo.xcprivacy to some frameworks, rebuild Darwin libs * exclude header "pyport.h" * Use "v2" (SSE instructions) Python distributive on Linux * Update secure GitHub token in AppVeyor config Replaced the encrypted value of the GITHUB_TOKEN in .appveyor.yml to update credentials for CI builds. * Fix framework identifier formatting in xcframework_utils.sh Ensures that the generated framework identifier does not start with a dash and defaults to 'framework' if empty. This improves compatibility and prevents invalid identifiers when creating xcframeworks from dylibs. * Enable macOS build job in AppVeyor config Uncommented the job for building Python for iOS and macOS using the macos-sonoma worker image. The Linux build job was commented out, shifting focus to macOS builds. * Exclude module.modulemap from framework headers Updated the packaging script and exclude file to remove module.modulemap from Python.framework Headers for both iOS and macOS targets. This helps prevent unwanted module map files from being included in the packaged frameworks. * Fix CFBundlePackageType in generated plist Change CFBundlePackageType from 'APPL' to 'FMWK' in the create_plist function to correctly identify the bundle as a framework. * Migrate CI from AppVeyor to GitHub Actions Remove legacy .appveyor.yml and add a GitHub Actions workflow (build-python.yml) to build Python packages for iOS/macOS, Android, Linux and Windows. The new workflow runs on macOS, Ubuntu and Windows runners, sets PYTHON_VERSION to 3.12.12 (short: 3.12), produces and uploads per-platform artifacts, and includes a commented-out release publishing step. This migrates CI off AppVeyor and centralizes builds in GitHub Actions. * Run Python build on pushes to any branch Replace explicit branch list (main, master) with a wildcard ('**') in .github/workflows/build-python.yml so the workflow triggers on pushes to any branch. Keeps workflow_dispatch and other settings unchanged; this ensures CI runs for feature branches and other non-main branches. * Use macos-15 runner in build workflow Bump GitHub Actions runner from macos-14 to macos-15 in the build-python workflow so CI uses the updated macOS image for building Python for iOS and macOS. * Update Windows Python installer in workflow Modify the Windows job in build-python.yml to install Python 3.12.10 directly. Removed the prior "Show bundled Python" step, renamed the step to "Install requested Python version", and simplified the installer commands by dropping the uninstall and dynamic %PYTHON_VERSION% download; the workflow now downloads and silently installs python-3.12.10 before compiling the stdlib and packaging the distribution. * Bump setup-python and add Windows Python var Add PYTHON_WINDOWS_VERSION env var and use it in the Windows job to download/install the matching Python installer instead of hardcoding 3.12.10. Also upgrade actions/setup-python from v5 to v6. These changes make the Windows packaging step configurable and update the setup action to the newer release. * Use PYTHON_VERSION_SHORT for setup-python Update the GitHub Actions workflow to pass env.PYTHON_VERSION_SHORT to actions/setup-python instead of env.PYTHON_VERSION. This ensures the setup action receives the short version string (e.g., "3.11") in the expected format when installing Python; other steps remain unchanged. * Use env bash and set strict shell options Make shell usage explicit in CI and harden scripts for portability and safety. The workflow now sets shell: bash and calls scripts with bash; script shebangs were changed to #!/usr/bin/env bash and strict options (set -euo pipefail) were enabled. Minor fixes: ensure script invocations use bash and add missing trailing newlines. Affected files: .github/workflows/build-python.yml, android/build-all.sh, android/package-for-dart.sh, darwin/package-ios-for-dart.sh, darwin/package-macos-for-dart.sh, linux/package-for-linux.sh. * Add PYTHON_DIST_RELEASE and fix version var Update CI workflow (.github/workflows/build-python.yml): remove quotes from PYTHON_VERSION_SHORT (use numeric 3.12) and add PYTHON_DIST_RELEASE=20260203 to track the Python distribution release. This adjusts environment variables used by the Python build jobs. * Bump Android NDK version to r29 Update Android NDK references from r27/r27c to r29 across the build scripts and docs. Changes update android/README.md, set NDK_VERSION=r29 in android/android-env.sh, and adjust the ndk_version in android/patches/3.13_pending.patch to 29.0.14206865 so builds use the newer NDK. * Revamp Windows build; disable other jobs Remove PYTHON_WINDOWS_VERSION and comment out the darwin, android and linux jobs in the build workflow. Replace the previous simple Windows installer step with a PowerShell-based flow that downloads CPython sources, builds PCbuild (Release and Debug), collects binaries, DLLs, libs and stdlib, compiles bytecode-only stdlib, and packages the result into a zip. Adds layout validation to fail early if expected files/directories are missing and preserves existing artifact upload for the windows job. * Show package dir on missing files; drop doc checks Remove LICENSE.txt and NEWS.txt from the required package entries so builds no longer fail when those optional doc files are absent. Also add an ls $packageRoot before throwing the missing-file error to print the package directory contents and aid debugging when required entries are missing. * Prune unnecessary files from Windows Python package Centralize lists of files/dirs to remove and prune the Windows packaging output before zipping. Adds variables for lib dirs, DLL filename patterns, specific DLLs, and import libs to keep, then removes test/idlelib/tkinter/turtledemo dirs, unwanted *.pyd DLLs, listed DLL files, and non-kept .lib files from the package. This keeps the produced zip closer to the installer layout/size and makes cleanup lists easier to maintain. * Prune extra lib dirs and pip packages Update the Windows packaging step to exclude additional standard-lib directories (ensurepip, pydoc_data, lib2to3) and to remove bundled packaging packages from site-packages. Adds $pruneSitePackagesPatterns (pip*, setuptools*, wheel*) and a loop that deletes matching entries under Lib/site-packages to reduce archive size and remove unnecessary tooling from the distributed Python zip. * Move Windows Python packaging to script Replace the large inline PowerShell packaging block in .github/workflows/build-python.yml with a single invocation of windows/package-for-dart.ps1. Add the new packaging script (windows/package-for-dart.ps1) that encapsulates downloading, building and packaging CPython and uses a new exclude list (windows/python-windows-dart.exclude) to prune files. Remove obsolete files windows/exclude.txt and windows/unattend.xml. This centralizes packaging logic, simplifies the workflow file, and improves maintainability. * Enable platform build and release jobs in CI Uncomment and enable CI jobs for Darwin, Android, and Linux builds and the publish-release workflow. Restores the full job steps (checkout, setup Python, build/package, and upload artifacts) and standardizes YAML formatting. Also updates the release tag to use the full PYTHON_VERSION when publishing assets. * Copy pyconfig.h into Windows package include Ensure the generated Windows pyconfig.h (from the PC directory) is present and packaged. The script now checks for the header and throws if missing, then copies it to the package include directory (overwriting if necessary). This guarantees the platform-specific pyconfig.h is bundled for consumers building against the package. * Setup Python and print version in workflow Add a Setup Python step (actions/setup-python@v6) that uses the PYTHON_VERSION_SHORT env var, and a step to show the Python versions (python --version and py -3 --version) before the Build CPython step. This ensures the runner has the expected Python interpreter available and makes it easier to debug/version-check the environment prior to building and packaging. * Prune empty dirs and drop Scripts requirement Add a post-cleanup step to remove empty directories left after exclusions and cleanup (recursively, sorting by path length to remove nested dirs first). Also remove "$packageRoot\Scripts" from the required layout entries so the script no longer fails if that folder is absent. * Use python executable & multiline PS args Replace usage of the Windows py launcher with an explicit python invocation and format the PowerShell call to package-for-dart.ps1 across multiple lines. - workflow: print the python executable (python -c) instead of calling py -3 --version, and invoke the packaging script with PowerShell line continuations for readability. - script: switch compile step in windows/package-for-dart.ps1 from py -3 -m compileall to python -m compileall to avoid relying on the py launcher. These changes make the CI and packaging scripts use the active python interpreter directly and improve command readability in the workflow. * Force PCbuild to use configured Python Resolve the python executable via Get-Command and set PYTHON and PYTHON_FOR_BUILD environment variables (erroring if python is not in PATH). This ensures PCbuild helper scripts use the configured Python executable instead of the py.exe launcher before invoking PCbuild\build.bat. * Use short Python version for release tag Update the GitHub Actions publish step to use env.PYTHON_VERSION_SHORT for the release tag_name instead of the full PYTHON_VERSION. This ensures generated release tags use the shorter/version identifier (e.g., 3.9) expected for release naming when publishing artifacts. * Support Python 3.13 Android builds and packaging Bump CI to Python 3.13.12 and add logic to handle CPython 3.13+ changes: only arm64-v8a and x86_64 ABIs are supported by the official Android/android.py flow, so build scripts and the GitHub workflow now compute a version_int and conditionally skip armeabi-v7a for 3.13+. build.sh was updated to use CPython's Android tooling for >=3.13, set ANDROID_HOME/ANDROID_API_LEVEL/NDK linkage as needed, and enforce supported ABIs. The legacy 3.13_pending patch was removed. Packaging scripts for Android, iOS and macOS now require a host pythonX.Y to compile stdlib bytecode with an isolated interpreter (-I -m compileall -b) to avoid importing from target dirs. README updated to note the new CPython Android build flow and ABI support. * Make packaging scripts robust for Python versions Add resilience and version-awareness to Android and Windows packaging scripts. The Android script now creates a downloads directory. The Windows script derives a pythonTag from the short version to generalize DLL/import-lib names, searches multiple candidate locations for pyconfig.h with a clearer error message, and updates file selection to use the tagged names. Also use the chosen Python executable (& $pythonFromPath -I) when running compileall to ensure the correct interpreter is used. * Migrate Android build to official Python 3.13 flow Switch Android build tooling to CPython's official Android/android.py flow and restrict support to Python 3.13.x and modern ABIs. Removed legacy cross-compile helpers, many version-specific patches, and android-env.sh; simplified abi mappings (drop armeabi-v7a/x86), updated build scripts to only handle arm64-v8a and x86_64, and added explicit checks/failures for unsupported versions/abis. CI packaging no longer includes armeabi-v7a for older Python versions. package-for-dart now locates NDK_HOME from common SDK locations (and fails if none found) and validates llvm-strip. README updated to reflect Python 3.13-only support. These changes clean up custom workarounds kept for older Python/NDK combinations and rely on upstream CPython Android tooling. * Derive PYTHON_VERSION_SHORT and validate env vars Remove the hardcoded PYTHON_VERSION_SHORT and instead derive it from PYTHON_VERSION in workflow steps (bash and PowerShell) so the short version is available via GITHUB_ENV. In linux/package-for-linux.sh, add required env var checks for PYTHON_VERSION and PYTHON_DIST_RELEASE, provide a fallback derivation for PYTHON_VERSION_SHORT, update the compile path to use the short version, and quote paths when creating the tarball. These changes make CI and packaging robust across Python patch releases and different runner shells. * Add legacy Android build support & patches Enable building older Python releases for Android using a legacy patched cross-build flow and add necessary patches and tooling. Changes include: - Add android/android-env.sh to configure NDK/r27d toolchain, environment variables, and cross-compile flags. - Add multiple patches (bldlibrary, grp, python_for_build_deps, soname, sysroot_paths) to fix cross-compilation, linking and packaging issues on Android. - Update build scripts to be version-aware: - .github workflow now packages armeabi-v7a for Python < 3.13. - android/build-all.sh selects ABIs based on Python version (3.13+ uses official tool, older versions include armeabi-v7a and x86). - android/build.sh applies patches and either uses the legacy cross-build flow (for <= 3.12) with prebuilt libs and custom configure/make/install steps or uses CPython's Android/android.py for 3.13+. - Set CCSHARED, CONFIG_SITE, sysroot include/lib paths and other flags needed for current NDKs and cross-compilation. - Add ABI-to-host mappings for armeabi-v7a and x86 in android/abi-to-host.sh. - Improve NDK detection in android/package-for-dart.sh to prefer locally installed NDKs. - Update android/README.md to document the two build flows (3.12 legacy vs 3.13+ official) and ABI support. These changes allow building and packaging older Python versions for a wider set of Android ABIs and fix several cross-compile/link/runtime issues encountered when targeting Android. * Use Python 3.12.12 in CI workflow Update .github/workflows/build-python.yml to change PYTHON_VERSION from 3.13.12 to 3.12.12. PYTHON_DIST_RELEASE remains unchanged. This ensures the CI uses the 3.12.12 Python build. * Introduce reusable Python build workflow Add a reusable workflow (.github/workflows/build-python-version.yml) that builds Python packages for Darwin, Android, Linux, and Windows and publishes release assets. Update build-python.yml to expose a workflow_dispatch input for selecting versions and to run the new workflow as a matrix over supported Python versions (3.12.12, 3.13.12, 3.14.3), inheriting secrets. This DRYs up per-version build logic and enables reuse via workflow_call. * Make reusable Python workflow dispatchable Rename reusable workflow and add workflow_dispatch so the reusable workflow can be run manually with a Python version choice. Update PYTHON_VERSION env to read from either workflow_call inputs or workflow_dispatch event inputs. Remove duplicate workflow_dispatch inputs and the conditional in build-python.yml so the matrix always invokes the reusable workflow for each version (3.12.12, 3.13.12, 3.14.3). This simplifies manual runs and centralizes version handling in the reusable workflow. * Use extracted Python interpreter for compileall Look up and use the Python binary from the extracted runtime (bin/python<VERSION>, then bin/python3, then bin/python) when running compileall. Fail with an error if no interpreter is found, and invoke compileall with -I to avoid importing site-packages. This makes the build use the bundled interpreter instead of relying on a system python. * Bump setup-python to v6; improve python detection Update GitHub Actions to use actions/setup-python@v6 in the workflow (added missing setup step and python --version checks). In linux/package-for-linux.sh, replace hard-coded build-path checks with command -v lookups: try python$PYTHON_VERSION_SHORT, then python3, then python. Use empty-string checks instead of -x and update the error message to indicate the host Python interpreter is missing for compileall. These changes make CI use the newer action and make runtime Python detection more robust across environments.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.