Stop shipping code that implied Aman supported a two-pass editor, external API cleanup, or a Wayland scaffold when the runtime only exercises single-pass local cleanup on X11.\n\nCollapse aiprocess to the active single-pass Llama contract, delete desktop_wayland and the empty wayland extra, and make model_eval reject pass1_/pass2_ tuning keys while keeping pass1_ms/pass2_ms as report compatibility fields.\n\nRemove the unused pillow dependency, switch to SPDX-style license metadata, and clean setuptools build state before packaging so deleted modules do not leak into wheels. Update the methodology and repo guidance docs, and add focused tests for desktop adapter selection, stale param rejection, and portable wheel contents.\n\nValidate with uv lock, python3 -m unittest discover -s tests -p 'test_*.py', python3 -m py_compile src/*.py tests/*.py, and python3 -m build --wheel --sdist --no-isolation.
117 lines
3.1 KiB
Bash
Executable file
117 lines
3.1 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)"
|
|
DIST_DIR="${DIST_DIR:-${ROOT_DIR}/dist}"
|
|
BUILD_DIR="${BUILD_DIR:-${ROOT_DIR}/build}"
|
|
APP_NAME="aman"
|
|
|
|
mkdir -p "${DIST_DIR}" "${BUILD_DIR}"
|
|
|
|
require_command() {
|
|
local cmd="$1"
|
|
if command -v "${cmd}" >/dev/null 2>&1; then
|
|
return
|
|
fi
|
|
echo "missing required command: ${cmd}" >&2
|
|
exit 1
|
|
}
|
|
|
|
project_version() {
|
|
require_command python3
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
|
|
text = Path("pyproject.toml").read_text(encoding="utf-8")
|
|
match = re.search(r'(?m)^version\s*=\s*"([^"]+)"\s*$', text)
|
|
if not match:
|
|
raise SystemExit("project version not found in pyproject.toml")
|
|
print(match.group(1))
|
|
PY
|
|
}
|
|
|
|
project_name() {
|
|
require_command python3
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
import re
|
|
|
|
text = Path("pyproject.toml").read_text(encoding="utf-8")
|
|
match = re.search(r'(?m)^name\s*=\s*"([^"]+)"\s*$', text)
|
|
if not match:
|
|
raise SystemExit("project name not found in pyproject.toml")
|
|
print(match.group(1))
|
|
PY
|
|
}
|
|
|
|
build_wheel() {
|
|
require_command python3
|
|
rm -rf "${ROOT_DIR}/build"
|
|
rm -rf "${BUILD_DIR}"
|
|
rm -rf "${ROOT_DIR}/src/${APP_NAME}.egg-info"
|
|
mkdir -p "${DIST_DIR}" "${BUILD_DIR}"
|
|
python3 -m build --wheel --no-isolation --outdir "${DIST_DIR}"
|
|
}
|
|
|
|
latest_wheel_path() {
|
|
require_command python3
|
|
python3 - <<'PY'
|
|
import os
|
|
from pathlib import Path
|
|
import re
|
|
|
|
text = Path("pyproject.toml").read_text(encoding="utf-8")
|
|
name_match = re.search(r'(?m)^name\s*=\s*"([^"]+)"\s*$', text)
|
|
version_match = re.search(r'(?m)^version\s*=\s*"([^"]+)"\s*$', text)
|
|
if not name_match or not version_match:
|
|
raise SystemExit("project metadata not found in pyproject.toml")
|
|
name = name_match.group(1).replace("-", "_")
|
|
version = version_match.group(1)
|
|
dist_dir = Path(os.environ.get("DIST_DIR", "dist"))
|
|
candidates = sorted(dist_dir.glob(f"{name}-{version}-*.whl"))
|
|
if not candidates:
|
|
raise SystemExit(f"no wheel artifact found in {dist_dir.resolve()}")
|
|
print(candidates[-1])
|
|
PY
|
|
}
|
|
|
|
render_template() {
|
|
local template_path="$1"
|
|
local output_path="$2"
|
|
shift 2
|
|
cp "${template_path}" "${output_path}"
|
|
for mapping in "$@"; do
|
|
local key="${mapping%%=*}"
|
|
local value="${mapping#*=}"
|
|
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
|
|
}
|