aman/packaging/arch/PKGBUILD.in
Thales Maciel 721248ca26
Decouple non-UI CLI startup from config_ui
Stop aman.py from importing the GTK settings module at module load so version, init, bench, diagnostics, and top-level help can start without pulling in the UI stack.\n\nPromote PyGObject and python-xlib into main project dependencies, switch the documented source install surface to plain uv/pip commands, and teach the portable, deb, and Arch packaging flows to install filtered runtime requirements before the Aman wheel so they still rely on distro-provided GTK/X11 packages.\n\nAdd regression coverage for importing aman with config_ui blocked and for the portable bundle's new requirements payload, then rerun the focused CLI/diagnostics/portable tests plus py_compile.
2026-03-14 13:38:15 -03:00

53 lines
1.8 KiB
Text

# Maintainer: Thales Maciel <thales@thalesmaciel.com>
pkgname=aman
pkgver=__VERSION__
pkgrel=1
pkgdesc="Local amanuensis daemon for X11 desktops"
arch=('x86_64')
url="https://git.thaloco.com/thaloco/aman"
license=('MIT')
depends=('python' 'python-pip' 'python-setuptools' 'portaudio' 'gtk3' 'libayatana-appindicator' 'python-gobject' 'python-xlib')
makedepends=('python-build' 'python-installer' 'python-wheel')
source=("__TARBALL_NAME__")
sha256sums=('__TARBALL_SHA256__')
prepare() {
cd "${srcdir}/aman-${pkgver}"
python -m build --wheel
python - <<'PY'
from pathlib import Path
import re
import tomllib
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
exclude = {"pygobject", "python-xlib"}
dependencies = project.get("project", {}).get("dependencies", [])
filtered = []
for dependency in dependencies:
match = re.match(r"\s*([A-Za-z0-9_.-]+)", dependency)
if not match:
continue
name = match.group(1).lower().replace("_", "-")
if name in exclude:
continue
filtered.append(dependency.strip())
Path("dist/runtime-requirements.txt").write_text("\n".join(filtered) + "\n", encoding="utf-8")
PY
}
package() {
cd "${srcdir}/aman-${pkgver}"
install -dm755 "${pkgdir}/opt/aman"
python -m venv --system-site-packages "${pkgdir}/opt/aman/venv"
"${pkgdir}/opt/aman/venv/bin/python" -m pip install --upgrade pip
"${pkgdir}/opt/aman/venv/bin/python" -m pip install --requirement "dist/runtime-requirements.txt"
"${pkgdir}/opt/aman/venv/bin/python" -m pip install --no-deps "dist/aman-${pkgver}-"*.whl
install -Dm755 /dev/stdin "${pkgdir}/usr/bin/aman" <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
exec /opt/aman/venv/bin/aman "$@"
EOF
install -Dm644 "systemd/aman.service" "${pkgdir}/usr/lib/systemd/user/aman.service"
}