forked from genewildish/Mainline
45 lines
1.5 KiB
Python
Executable File
45 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""
|
|
M A I N L I N E
|
|
Digital news consciousness stream.
|
|
Matrix aesthetic · THX-1138 hue.
|
|
"""
|
|
|
|
import subprocess, sys, pathlib
|
|
|
|
# ─── BOOTSTRAP VENV ───────────────────────────────────────
|
|
_VENV = pathlib.Path(__file__).resolve().parent / ".mainline_venv"
|
|
_MARKER = _VENV / ".installed_v3"
|
|
|
|
def _ensure_venv():
|
|
"""Create a local venv and install deps if needed."""
|
|
if _MARKER.exists():
|
|
return
|
|
import venv
|
|
print("\033[2;38;5;34m > first run — creating environment...\033[0m")
|
|
venv.create(str(_VENV), with_pip=True, clear=True)
|
|
pip = str(_VENV / "bin" / "pip")
|
|
subprocess.check_call(
|
|
[pip, "install", "feedparser", "Pillow", "-q"],
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL,
|
|
)
|
|
_MARKER.touch()
|
|
|
|
_ensure_venv()
|
|
|
|
# Install sounddevice on first run after v3
|
|
_MARKER_SD = _VENV / ".installed_sd"
|
|
if not _MARKER_SD.exists():
|
|
_pip = str(_VENV / "bin" / "pip")
|
|
subprocess.check_call([_pip, "install", "sounddevice", "numpy", "-q"],
|
|
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
_MARKER_SD.touch()
|
|
|
|
sys.path.insert(0, str(next((_VENV / "lib").glob("python*/site-packages"))))
|
|
|
|
# ─── DELEGATE TO ENGINE ───────────────────────────────────
|
|
from engine.app import main # noqa: E402
|
|
|
|
if __name__ == "__main__":
|
|
main()
|