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.
67 lines
2 KiB
Bash
Executable file
67 lines
2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
|
source "${SCRIPT_DIR}/package_common.sh"
|
|
|
|
require_command dpkg-deb
|
|
require_command python3
|
|
|
|
VERSION="$(project_version)"
|
|
PACKAGE_NAME="$(project_name)"
|
|
ARCH="${DEB_ARCH:-}"
|
|
if [[ -z "${ARCH}" ]]; then
|
|
if command -v dpkg >/dev/null 2>&1; then
|
|
ARCH="$(dpkg --print-architecture)"
|
|
else
|
|
ARCH="amd64"
|
|
fi
|
|
fi
|
|
|
|
build_wheel
|
|
WHEEL_PATH="$(latest_wheel_path)"
|
|
RUNTIME_REQUIREMENTS="${BUILD_DIR}/deb/runtime-requirements.txt"
|
|
write_runtime_requirements "${RUNTIME_REQUIREMENTS}"
|
|
|
|
STAGE_DIR="${BUILD_DIR}/deb/${PACKAGE_NAME}_${VERSION}_${ARCH}"
|
|
PACKAGE_BASENAME="${PACKAGE_NAME}_${VERSION}_${ARCH}"
|
|
DEB_PATH="${DIST_DIR}/${PACKAGE_BASENAME}.deb"
|
|
VENV_DIR="${STAGE_DIR}/opt/${PACKAGE_NAME}/venv"
|
|
PIP_ARGS=()
|
|
if [[ -n "${AMAN_WHEELHOUSE_DIR:-}" ]]; then
|
|
PIP_ARGS+=(--no-index --find-links "${AMAN_WHEELHOUSE_DIR}")
|
|
fi
|
|
|
|
rm -rf "${STAGE_DIR}"
|
|
mkdir -p "${STAGE_DIR}/DEBIAN"
|
|
mkdir -p "${STAGE_DIR}/usr/bin"
|
|
mkdir -p "${STAGE_DIR}/usr/lib/systemd/user"
|
|
mkdir -p "${STAGE_DIR}/opt/${PACKAGE_NAME}"
|
|
|
|
render_template \
|
|
"${ROOT_DIR}/packaging/deb/control.in" \
|
|
"${STAGE_DIR}/DEBIAN/control" \
|
|
"PACKAGE_NAME=${PACKAGE_NAME}" \
|
|
"VERSION=${VERSION}" \
|
|
"ARCH=${ARCH}"
|
|
|
|
cp "${ROOT_DIR}/packaging/deb/postinst" "${STAGE_DIR}/DEBIAN/postinst"
|
|
chmod 0755 "${STAGE_DIR}/DEBIAN/postinst"
|
|
|
|
python3 -m venv --system-site-packages "${VENV_DIR}"
|
|
"${VENV_DIR}/bin/python" -m pip install "${PIP_ARGS[@]}" --requirement "${RUNTIME_REQUIREMENTS}"
|
|
"${VENV_DIR}/bin/python" -m pip install "${PIP_ARGS[@]}" --no-deps "${WHEEL_PATH}"
|
|
|
|
cat >"${STAGE_DIR}/usr/bin/${PACKAGE_NAME}" <<EOF
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
exec /opt/${PACKAGE_NAME}/venv/bin/${PACKAGE_NAME} "\$@"
|
|
EOF
|
|
chmod 0755 "${STAGE_DIR}/usr/bin/${PACKAGE_NAME}"
|
|
|
|
cp "${ROOT_DIR}/systemd/aman.service" "${STAGE_DIR}/usr/lib/systemd/user/aman.service"
|
|
|
|
rm -f "${DEB_PATH}"
|
|
dpkg-deb --build --root-owner-group "${STAGE_DIR}" "${DEB_PATH}"
|
|
echo "built ${DEB_PATH}"
|