33 lines
1.2 KiB
Shell
33 lines
1.2 KiB
Shell
|
|
#!/usr/bin/env bash
|
||
|
|
# Creates an isolated venv for buildozer/cython so the Android build
|
||
|
|
# tooling never touches Arch's externally-managed system Python.
|
||
|
|
# Safe to re-run — skips venv creation if it already exists, and
|
||
|
|
# pip install is idempotent.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# ---- Configuration ----
|
||
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
BUILD_DIR="$SCRIPT_DIR/build"
|
||
|
|
VENV_DIR="$BUILD_DIR/venv"
|
||
|
|
|
||
|
|
mkdir -p "$BUILD_DIR"
|
||
|
|
|
||
|
|
if [ ! -d "$VENV_DIR" ]; then
|
||
|
|
echo "Creating venv at $VENV_DIR"
|
||
|
|
# Plain isolated venv — no --system-site-packages. buildozer's own
|
||
|
|
# `pip install --user ...` bootstrap step (for p4a's build deps) is
|
||
|
|
# skipped automatically when it sees $VIRTUAL_ENV set, which build.sh
|
||
|
|
# sets — see the comment there. --system-site-packages was tried
|
||
|
|
# briefly to work around that instead, but it leaks the real system
|
||
|
|
# Python's installed packages into what buildozer decides the app
|
||
|
|
# needs to bundle, which is worse.
|
||
|
|
python3 -m venv "$VENV_DIR"
|
||
|
|
fi
|
||
|
|
|
||
|
|
"$VENV_DIR/bin/pip" install --upgrade pip
|
||
|
|
"$VENV_DIR/bin/pip" install buildozer cython
|
||
|
|
|
||
|
|
echo
|
||
|
|
echo "Build environment ready."
|
||
|
|
echo "Run the build with: $SCRIPT_DIR/build.sh android debug"
|
||
|
|
echo "(or activate it directly: source $VENV_DIR/bin/activate)"
|