sok.core.updater
Application update management.
Provides functionality to check for updates from GitHub releases, download new versions, and manage the update installation process.
UpdateManager
class UpdateManager()Manages update verification and retrieval via GitHub Releases.
Initialize the update manager.
Sets up the manager with no cached release data.
SourceAttributes
| Name | Type |
|---|---|
API_URL | |
GITHUB_REPO | |
latest_release | Optional[Dict[str, Any]] |
check_for_updatesasync
async def check_for_updates() -> Tuple[bool, Optional[str]]:Check if an update is available.
Returns
Tuple[bool, Optional[str]]Tuple[bool, str]: (Is there an update?, Detected version)
download_and_install
def download_and_install(url: str, progress_callback=None):Download the installer and launch it (on macOS, open the disk image; on Linux, replace the AppImage). The caller then quits the app: this runs in a worker thread, where sys.exit() would only end the thread.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
url | str | ||
progress_callback | None |
get_download_url
def get_download_url() -> Optional[str]:Get the download URL of the installer for this platform. Windows: the setup .exe first, then any .exe. macOS: the .dmg. Linux: the AppImage of this architecture, when running from an AppImage (it replaces itself). Falls back to the release page.
Sourceget_release_notes
def get_release_notes() -> str:Return the changelog for the latest release.
Sourcereplace_appimage
def replace_appimage(url: str, progress_callback=None) -> None:Download the new AppImage over the one the app runs from.
The file keeps its path, so launchers and shortcuts still work. It is downloaded next to it, then renamed: the swap is atomic, and the running app keeps the old file open until it quits.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
url | str | ||
progress_callback | None |
Raises
OSErrorThe folder is not writable or the download failed.
restart_appimagestaticmethod
def restart_appimage() -> None:Start the updated AppImage; the caller then quits the app.
SourceFunctions
running_appimage
def running_appimage() -> Optional[Path]:Return the AppImage file the app runs from (Linux), else None.
The AppImage runtime sets APPIMAGE to the path of the file.
SourceAttributes
| Name | Value |
|---|---|
logger | logging.getLogger(__name__) |