Files
AI-Profile-Router/platform/docker/hermes-webui/patch_entrypoint.py

23 lines
999 B
Python

#!/usr/bin/env python3
"""Patch WebUI dependency bootstrap for modern non-wheel Hermes releases."""
from __future__ import annotations
import sys
from pathlib import Path
path = Path(sys.argv[1])
content = path.read_text(encoding="utf-8")
old = ''' uv pip install "$_stage_src[all]" --trusted-host pypi.org --trusted-host files.pythonhosted.org \\
|| error_exit "Failed to install hermes-agent's requirements"'''
new = ''' python3 /usr/local/bin/hermes_requirements.py "$_stage_src/pyproject.toml" \\
> /tmp/hermes-agent-requirements.txt \\
|| error_exit "Failed to export hermes-agent's requirements"
uv pip install -r /tmp/hermes-agent-requirements.txt \\
--trusted-host pypi.org --trusted-host files.pythonhosted.org \\
|| error_exit "Failed to install hermes-agent's requirements"'''
if content.count(old) != 1:
raise SystemExit(f"Expected dependency bootstrap exactly once in {path}")
path.write_text(content.replace(old, new), encoding="utf-8")