Source code for repoman.paths
"""System binary discovery and startup validation.
Resolves paths for pkexec, lsb_release, and optional companion tools
(update-manager, software-properties-gtk) at import time via shutil.which,
so tests can monkeypatch shutil.which before importing this module.
"""
from __future__ import annotations
import shutil
from pathlib import Path
def _find(name: str) -> str:
"""Return the full path of a system binary, or the bare name as fallback."""
return shutil.which(name) or name
# System binaries — resolved at import time so tests can monkeypatch shutil.which
PKEXEC = _find("pkexec")
LSB_RELEASE = _find("lsb_release")
# Optional companion tools — None if not installed on this system
UPDATE_MANAGER = shutil.which("update-manager")
SOFTWARE_PROPERTIES = shutil.which("software-properties-gtk")
GDEBI = shutil.which("gdebi-gtk")
POLKIT_HELPER = "/usr/lib/repoman/polkit-helper"