bambuddy/spoolbuddy/daemon/__init__.py
maziggy 18700cf5da Fix SpoolBuddy daemon reporting stale version in update check
The daemon had a hardcoded __version__ = "0.2.2b1" that was never
  bumped, causing the update check to always show an update available.
  Changed to read APP_VERSION from backend/app/core/config.py at import
  time so the daemon version stays in sync automatically.
2026-03-22 13:08:45 +01:00

18 lines
524 B
Python

import re
from pathlib import Path
def _read_app_version() -> str:
"""Read APP_VERSION from backend config — single source of truth."""
config_path = Path(__file__).resolve().parent.parent.parent / "backend" / "app" / "core" / "config.py"
try:
text = config_path.read_text()
match = re.search(r'^APP_VERSION\s*=\s*["\'](.+?)["\']', text, re.MULTILINE)
if match:
return match.group(1)
except OSError:
pass
return "0.0.0"
__version__ = _read_app_version()