"""Emplacements partagés par les commandes : dépôt, application QML, libfbxqml et qmlscene. REPO_DIR : racine du dépôt (outils, dist/, deploy.log) ; APP_DIR : REPO_DIR/app, seul dossier envoyé au Freebox Player (manifest.json, QML, images). """ import os import shutil import sys from pathlib import Path def _find_root() -> Path: """Dossier contenant app/manifest.json : depuis le dossier courant, sinon depuis ce module.""" for start in (Path.cwd(), Path(__file__).resolve().parent): for folder in (start, *start.parents): if (folder / "app" / "manifest.json").is_file() and (folder / "pyproject.toml").is_file(): return folder sys.exit("Projet introuvable : lancez la commande depuis le dépôt Jellyfin-Freebox.") REPO_DIR = _find_root() APP_DIR = REPO_DIR / "app" def libfbxqml() -> Path: """libfbxqml (module fbx.application en QML pur) : ../libfbxqml, ou $LIBFBXQML.""" path = Path(os.environ.get("LIBFBXQML", REPO_DIR.parent / "libfbxqml")) if not (path / "fbx").is_dir(): sys.exit("libfbxqml introuvable : git clone https://github.com/fbx/libfbxqml.git %s" % path) return path def qmlscene() -> str: """qmlscene de Qt 5 : $QMLSCENE, le PATH, ou l'emplacement Debian/Ubuntu.""" path = os.environ.get("QMLSCENE") or shutil.which("qmlscene") or "/usr/lib/qt5/bin/qmlscene" if not os.path.exists(path) and not shutil.which(path): sys.exit("qmlscene introuvable : sudo apt install qmlscene") return path