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.
This commit is contained in:
parent
b4a3d446fa
commit
721248ca26
15 changed files with 173 additions and 35 deletions
|
|
@ -84,3 +84,30 @@ render_template() {
|
|||
sed -i "s|__${key}__|${value}|g" "${output_path}"
|
||||
done
|
||||
}
|
||||
|
||||
write_runtime_requirements() {
|
||||
local output_path="$1"
|
||||
require_command python3
|
||||
python3 - "${output_path}" <<'PY'
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
import tomllib
|
||||
|
||||
output_path = Path(sys.argv[1])
|
||||
exclude = {"pygobject", "python-xlib"}
|
||||
project = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))
|
||||
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())
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
output_path.write_text("\n".join(filtered) + "\n", encoding="utf-8")
|
||||
PY
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ 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}"
|
||||
|
|
@ -48,7 +50,8 @@ 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[@]}" "${WHEEL_PATH}"
|
||||
"${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
|
||||
|
|
|
|||
|
|
@ -49,12 +49,22 @@ export_requirements() {
|
|||
--python "${python_version}" >"${raw_path}"
|
||||
python3 - "${raw_path}" "${output_path}" <<'PY'
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
raw_path = Path(sys.argv[1])
|
||||
output_path = Path(sys.argv[2])
|
||||
lines = raw_path.read_text(encoding="utf-8").splitlines()
|
||||
filtered = [line for line in lines if line.strip() != "."]
|
||||
exclude = {"pygobject", "python-xlib"}
|
||||
filtered = []
|
||||
for line in lines:
|
||||
stripped = line.strip()
|
||||
if not stripped or stripped == ".":
|
||||
continue
|
||||
match = re.match(r"([A-Za-z0-9_.-]+)", stripped)
|
||||
if match and match.group(1).lower().replace("_", "-") in exclude:
|
||||
continue
|
||||
filtered.append(line)
|
||||
output_path.write_text("\n".join(filtered) + "\n", encoding="utf-8")
|
||||
raw_path.unlink()
|
||||
PY
|
||||
|
|
@ -81,6 +91,7 @@ WHEEL_PATH="$(latest_wheel_path)"
|
|||
|
||||
rm -rf "${PORTABLE_STAGE_DIR}"
|
||||
mkdir -p "${PORTABLE_STAGE_DIR}/wheelhouse/common"
|
||||
mkdir -p "${PORTABLE_STAGE_DIR}/requirements"
|
||||
mkdir -p "${PORTABLE_STAGE_DIR}/systemd"
|
||||
|
||||
cp "${WHEEL_PATH}" "${PORTABLE_STAGE_DIR}/wheelhouse/common/"
|
||||
|
|
@ -98,14 +109,18 @@ python3 "${ROOT_DIR}/packaging/portable/portable_installer.py" \
|
|||
--version "${VERSION}" \
|
||||
--output "${PORTABLE_STAGE_DIR}/manifest.json"
|
||||
|
||||
TMP_REQ_DIR="${BUILD_DIR}/portable/requirements"
|
||||
mkdir -p "${TMP_REQ_DIR}"
|
||||
export_requirements "3.10" "${TMP_REQ_DIR}/cp310.txt"
|
||||
export_requirements "3.11" "${TMP_REQ_DIR}/cp311.txt"
|
||||
export_requirements "3.12" "${TMP_REQ_DIR}/cp312.txt"
|
||||
cp "${TMP_REQ_DIR}/cp310.txt" "${PORTABLE_STAGE_DIR}/requirements/cp310.txt"
|
||||
cp "${TMP_REQ_DIR}/cp311.txt" "${PORTABLE_STAGE_DIR}/requirements/cp311.txt"
|
||||
cp "${TMP_REQ_DIR}/cp312.txt" "${PORTABLE_STAGE_DIR}/requirements/cp312.txt"
|
||||
|
||||
if [[ -n "${TEST_WHEELHOUSE_ROOT}" ]]; then
|
||||
copy_prebuilt_wheelhouse "${TEST_WHEELHOUSE_ROOT}" "${PORTABLE_STAGE_DIR}/wheelhouse"
|
||||
else
|
||||
TMP_REQ_DIR="${BUILD_DIR}/portable/requirements"
|
||||
mkdir -p "${TMP_REQ_DIR}"
|
||||
export_requirements "3.10" "${TMP_REQ_DIR}/cp310.txt"
|
||||
export_requirements "3.11" "${TMP_REQ_DIR}/cp311.txt"
|
||||
export_requirements "3.12" "${TMP_REQ_DIR}/cp312.txt"
|
||||
download_python_wheels "cp310" "310" "cp310" "${TMP_REQ_DIR}/cp310.txt" "${PORTABLE_STAGE_DIR}/wheelhouse/cp310"
|
||||
download_python_wheels "cp311" "311" "cp311" "${TMP_REQ_DIR}/cp311.txt" "${PORTABLE_STAGE_DIR}/wheelhouse/cp311"
|
||||
download_python_wheels "cp312" "312" "cp312" "${TMP_REQ_DIR}/cp312.txt" "${PORTABLE_STAGE_DIR}/wheelhouse/cp312"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue