Files
Noah 024254a288 fix(build): restore editable installs after stream_gears packaging change (#1734)
* fix(build): restore editable installs after stream_gears packaging change

Editable installs only put python-source (crates/stream-gears) on sys.path and skip include, so the root biliup/ package was unimportable after maturin develop / pip install -e . Add crates/stream-gears/biliup/__init__.py, which loads the root package under the same name. Wheels are unchanged: maturin only walks stream_gears/ and the include globs, which match the root biliup/ first.

* test(stream-gears): cover editable installs

test_wheel_ships_stubs only checks RECORD for regular installs, since an editable install's RECORD lists the .pth. A new test puts only python-source on PYTHONPATH and checks that biliup and biliup.__main__ resolve to the root package.

* build: move biliup/ and pyproject.toml into crates/stream-gears

Editable installs (`maturin develop`, `pip install -e`) only put
`python-source` on sys.path and skip `include`, so with `biliup/` at the
repository root they could not import it. With `pyproject.toml`,
`biliup/` and `stream_gears/` in the same directory, `biliup` goes in
through `python-packages`, which editable installs honour.

- `biliup/` is moved unchanged; the loader added earlier in this PR is
  removed because that path is now the real package.
- `readme` and `license` point at the repository root, so the wheel's
  METADATA and `licenses/LICENSE` stay the same.
- CI, Termux and the Dockerfile build with
  `-m crates/stream-gears/Cargo.toml`.

Ref #1732

* docs: point source install commands at crates/stream-gears
2026-09-24 09:30:04 +00:00

63 lines
2.3 KiB
YAML

name: Build Termux Wheel to Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build frontend
run: |
npm install
npm run build
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Set up Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26d
- name: Install dependencies and Android target
run: |
pip install maturin
rustup target add aarch64-linux-android
- name: Set up CPython interpreter for cross-compilation
run: |
BASE_URL="https://packages.termux.dev/apt/termux-main/pool/main/p/python"
FNAME=$(curl -s "$BASE_URL/" | grep -oP '(?<=href=")python_[^"]+_aarch64\.deb' | head -n 1)
wget -nv "$BASE_URL/$FNAME"
mkdir python
dpkg-deb -x $FNAME python
cp -a python/data/data/com.termux/files/usr/lib/libpython* $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/24
sed -i 's/"abi3-py[0-9]*",\? *//g' crates/stream-gears/Cargo.toml
sed -i 's/aiohttp\[speedups\] >= 3\.9\.5/aiohttp[speedups] <= 3.9.5/' crates/stream-gears/pyproject.toml
- name: Build wheel for aarch64 (Termux)
run: |
export NDK_BIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin
export CC_aarch64_linux_android=$NDK_BIN/aarch64-linux-android24-clang
export AR_aarch64_linux_android=$NDK_BIN/llvm-ar
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$NDK_BIN/aarch64-linux-android24-clang
export PYO3_CROSS_LIB_DIR=python/data/data/com.termux/files/usr/lib/
maturin build \
-m crates/stream-gears/Cargo.toml \
--release \
--strip \
--manylinux off \
--target aarch64-linux-android \
--out dist
- name: Upload wheel to release
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}