feat: real release notes, restart button, reliable .run installer (0.0.10)
release / release (push) Successful in 14s
release / release (push) Successful in 14s
- feat(ci): set each Gitea release body from the matching CHANGELOG section (was hardcoded "Automated release for…") - feat(updater): show "What's new" — release notes dialog before applying (GUI) and in `rigdoctor update` (CLI); fetch_latest/update_state now return notes - feat(gui): "Restart now" button relaunches the app after an update is applied - fix(packaging): build the self-extracting .run with a pure-Python extractor (packaging/make_run.py) instead of makeself, so it attaches to every release (it was silently skipped before) - chore: adopt Conventional Commits + git-cliff (cliff.toml, packaging/ changelog.sh) for changelog generation going forward (D20) - chore(gui): drop internal module refs (M4, M5, …) from Setup descriptions Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""RigDoctor — modular hardware monitoring & crash diagnostics for Linux gamers."""
|
||||
|
||||
__version__ = "0.0.8"
|
||||
__version__ = "0.0.10"
|
||||
|
||||
@@ -228,7 +228,7 @@ def cmd_login(args) -> int:
|
||||
print("No token provided.")
|
||||
return 1
|
||||
config.save_token(token)
|
||||
state, tag = updates.update_state()
|
||||
state, tag, _notes = updates.update_state()
|
||||
if state == updates.AUTH:
|
||||
print("Token saved, but the server rejected it (check scope/permissions).")
|
||||
return 1
|
||||
@@ -248,7 +248,7 @@ def cmd_logout(args) -> int:
|
||||
def cmd_update(args) -> int:
|
||||
from .core import updates
|
||||
|
||||
state, tag = updates.update_state()
|
||||
state, tag, notes = updates.update_state()
|
||||
if state == updates.NO_TOKEN:
|
||||
print("No update token. Run `rigdoctor login` after creating one at:")
|
||||
print(f" {updates.TOKEN_PAGE}")
|
||||
@@ -264,6 +264,8 @@ def cmd_update(args) -> int:
|
||||
return 0
|
||||
# AVAILABLE
|
||||
print(f"Update available: {tag} (current v{__version__}).")
|
||||
if notes:
|
||||
print("\nWhat's new:\n" + "\n".join(" " + ln for ln in notes.splitlines()) + "\n")
|
||||
if args.check:
|
||||
return 0
|
||||
print(f"Installing {tag}…")
|
||||
|
||||
@@ -23,7 +23,7 @@ class Component:
|
||||
COMPONENTS: tuple[Component, ...] = (
|
||||
Component(
|
||||
"smartmontools", "SMART disk health", "Diagnostics",
|
||||
"Disk health (SMART) in the health report (M4)", ("smartmontools",), "smartctl",
|
||||
"Disk health (SMART) in the health report", ("smartmontools",), "smartctl",
|
||||
),
|
||||
Component(
|
||||
"lm-sensors", "lm-sensors", "Diagnostics",
|
||||
@@ -31,7 +31,7 @@ COMPONENTS: tuple[Component, ...] = (
|
||||
),
|
||||
Component(
|
||||
"dmidecode", "dmidecode", "Diagnostics",
|
||||
"Motherboard / BIOS / RAM details for system inventory (M5)", ("dmidecode",), "dmidecode",
|
||||
"Motherboard / BIOS / RAM details for system inventory", ("dmidecode",), "dmidecode",
|
||||
),
|
||||
Component(
|
||||
"pciutils", "pciutils", "Diagnostics",
|
||||
@@ -39,10 +39,10 @@ COMPONENTS: tuple[Component, ...] = (
|
||||
),
|
||||
Component(
|
||||
"libnotify", "Desktop notifications", "Monitoring",
|
||||
"Desktop alert notifications (M8)", ("libnotify-bin",), "notify-send",
|
||||
"Desktop alert notifications", ("libnotify-bin",), "notify-send",
|
||||
),
|
||||
Component(
|
||||
"libsecret", "Encrypted token storage", "Updates",
|
||||
"Store the update token in the OS keyring, encrypted (M13)", ("libsecret-tools",), "secret-tool",
|
||||
"Store the update token in the OS keyring, encrypted", ("libsecret-tools",), "secret-tool",
|
||||
),
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"""Update check (M13): ask the Gitea releases API for the latest version.
|
||||
"""Update check (M13): ask the Gitea releases API for the latest version + notes.
|
||||
|
||||
Stdlib-only (urllib). The Gitea instance requires sign-in, so updates are gated to
|
||||
account holders via a Personal Access Token (D18): set $RIGDOCTOR_TOKEN or save one
|
||||
with `rigdoctor login`. Self-update (apply) is built on top of this; this module
|
||||
handles detection and exposes a clear state for the UI.
|
||||
with `rigdoctor login`. Returns the latest tag, its release notes (body), and a clear
|
||||
state for the UI; `apply_update` performs the no-root self-update.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -42,11 +42,11 @@ def is_newer(latest: str, current: str = __version__) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def fetch_latest(timeout: float = 5.0) -> tuple[str | None, str | None]:
|
||||
"""Return (tag, error). error is one of NO_TOKEN / AUTH / NETWORK, or None on success."""
|
||||
def fetch_latest(timeout: float = 5.0) -> tuple[str | None, str, str | None]:
|
||||
"""Return (tag, notes, error). error is NO_TOKEN/AUTH/NETWORK, or None on success."""
|
||||
token = load_token()
|
||||
if not token:
|
||||
return (None, NO_TOKEN)
|
||||
return (None, "", NO_TOKEN)
|
||||
req = urllib.request.Request(
|
||||
LATEST_API,
|
||||
headers={"Accept": "application/json", "Authorization": f"token {token}"},
|
||||
@@ -54,27 +54,27 @@ def fetch_latest(timeout: float = 5.0) -> tuple[str | None, str | None]:
|
||||
try:
|
||||
with urllib.request.urlopen(req, timeout=timeout) as resp: # noqa: S310 (https)
|
||||
data = json.load(resp)
|
||||
return (data.get("tag_name") or None, None)
|
||||
return (data.get("tag_name") or None, (data.get("body") or "").strip(), None)
|
||||
except urllib.error.HTTPError as exc:
|
||||
return (None, AUTH if exc.code in (401, 403) else NETWORK)
|
||||
return (None, "", AUTH if exc.code in (401, 403) else NETWORK)
|
||||
except Exception:
|
||||
return (None, NETWORK)
|
||||
return (None, "", NETWORK)
|
||||
|
||||
|
||||
def check_latest(timeout: float = 5.0) -> str | None:
|
||||
"""Convenience: latest tag or None (ignores error reason)."""
|
||||
tag, _ = fetch_latest(timeout)
|
||||
"""Convenience: latest tag or None (ignores notes/error)."""
|
||||
tag, _notes, _error = fetch_latest(timeout)
|
||||
return tag
|
||||
|
||||
|
||||
def update_state(timeout: float = 5.0) -> tuple[str, str | None]:
|
||||
"""Return (state, tag). state in NO_TOKEN/AUTH/NETWORK/UP_TO_DATE/AVAILABLE."""
|
||||
tag, error = fetch_latest(timeout)
|
||||
def update_state(timeout: float = 5.0) -> tuple[str, str | None, str]:
|
||||
"""Return (state, tag, notes). state in NO_TOKEN/AUTH/NETWORK/UP_TO_DATE/AVAILABLE."""
|
||||
tag, notes, error = fetch_latest(timeout)
|
||||
if error:
|
||||
return (error, None)
|
||||
return (error, None, "")
|
||||
if tag and is_newer(tag):
|
||||
return (AVAILABLE, tag)
|
||||
return (UP_TO_DATE, tag)
|
||||
return (AVAILABLE, tag, notes)
|
||||
return (UP_TO_DATE, tag, notes)
|
||||
|
||||
|
||||
def apply_update(tag: str) -> tuple[int, str]:
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
|
||||
from PySide6.QtCore import Qt, QTimer, Signal
|
||||
from PySide6.QtCore import Qt, QProcess, QTimer, Signal
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
QButtonGroup,
|
||||
QFrame,
|
||||
QHBoxLayout,
|
||||
QLabel,
|
||||
QMainWindow,
|
||||
QMessageBox,
|
||||
QPushButton,
|
||||
QStackedWidget,
|
||||
QVBoxLayout,
|
||||
@@ -75,6 +79,7 @@ class MainWindow(QMainWindow):
|
||||
# Update check (M13): once at launch, then periodically so a newly published
|
||||
# release is detected without restarting (interval from config; 0 disables).
|
||||
self._latest_tag = None
|
||||
self._latest_notes = ""
|
||||
self._applied = False
|
||||
self._update_checked.connect(self._show_update_state)
|
||||
self._update_applied.connect(self._on_update_applied)
|
||||
@@ -131,11 +136,33 @@ class MainWindow(QMainWindow):
|
||||
self._update_btn.clicked.connect(self._apply_update)
|
||||
self._update_btn.setVisible(False)
|
||||
v.addWidget(self._update_btn)
|
||||
self._restart_btn = QPushButton("Restart now")
|
||||
self._restart_btn.setObjectName("PrimaryButton")
|
||||
self._restart_btn.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
self._restart_btn.clicked.connect(self._restart)
|
||||
self._restart_btn.setVisible(False)
|
||||
v.addWidget(self._restart_btn)
|
||||
return bar
|
||||
|
||||
def _restart(self) -> None:
|
||||
gui = os.path.join(os.path.dirname(sys.executable), "rigdoctor-gui")
|
||||
if os.path.exists(gui):
|
||||
QProcess.startDetached(gui)
|
||||
else: # dev / not installed next to python
|
||||
QProcess.startDetached(sys.executable, sys.argv)
|
||||
QApplication.instance().quit()
|
||||
|
||||
def _apply_update(self) -> None:
|
||||
if not self._latest_tag:
|
||||
return
|
||||
box = QMessageBox(self)
|
||||
box.setWindowTitle(f"Update to {self._latest_tag}")
|
||||
box.setText(f"Update RigDoctor to {self._latest_tag}?")
|
||||
box.setInformativeText(self._latest_notes or "(no release notes)")
|
||||
box.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Cancel)
|
||||
box.button(QMessageBox.StandardButton.Ok).setText("Update")
|
||||
if box.exec() != QMessageBox.StandardButton.Ok:
|
||||
return
|
||||
self._update_btn.setEnabled(False)
|
||||
self._update_label.setText("updating…")
|
||||
tag = self._latest_tag
|
||||
@@ -144,8 +171,9 @@ class MainWindow(QMainWindow):
|
||||
def _on_update_applied(self, rc: int) -> None:
|
||||
if rc == 0:
|
||||
self._applied = True
|
||||
self._update_label.setText("updated — restart RigDoctor")
|
||||
self._update_label.setText("update installed")
|
||||
self._update_btn.setVisible(False)
|
||||
self._restart_btn.setVisible(True)
|
||||
if hasattr(self, "_update_timer"):
|
||||
self._update_timer.stop()
|
||||
else:
|
||||
@@ -161,8 +189,9 @@ class MainWindow(QMainWindow):
|
||||
def _show_update_state(self, result) -> None:
|
||||
if self._applied: # an update was applied this session; awaiting restart
|
||||
return
|
||||
state, tag = result
|
||||
state, tag, notes = result
|
||||
self._latest_tag = tag
|
||||
self._latest_notes = notes
|
||||
self._update_btn.setVisible(False)
|
||||
if state == updates.NO_TOKEN:
|
||||
self._update_label.setText("connect to update server")
|
||||
|
||||
@@ -185,7 +185,7 @@ class SetupPage(QWidget):
|
||||
self._upd_state.emit((config.token_backend(), updates.update_state()))
|
||||
|
||||
def _on_upd_state(self, result) -> None:
|
||||
backend, (state, tag) = result
|
||||
backend, (state, tag, _notes) = result
|
||||
msg = {
|
||||
updates.NO_TOKEN: "paste a token below to enable updates",
|
||||
updates.AUTH: "token rejected — check its scope/permissions",
|
||||
|
||||
Reference in New Issue
Block a user