Merge pull request #234795 from mweinelt/botamusique-version-backport

botamusique: Backport fix for invalid version handling
This commit is contained in:
Martin Weinelt 2023-05-31 20:32:52 +02:00 committed by GitHub
commit 5c4e4cd0a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 0 deletions

View file

@ -0,0 +1,24 @@
diff --git a/mumbleBot.py b/mumbleBot.py
index 11bc480..7395f41 100644
--- a/mumbleBot.py
+++ b/mumbleBot.py
@@ -188,11 +188,14 @@ class MumbleBot:
th.start()
last_startup_version = var.db.get("bot", "version", fallback=None)
- if not last_startup_version or version.parse(last_startup_version) < version.parse(self.version):
- var.db.set("bot", "version", self.version)
- if var.config.getboolean("bot", "auto_check_update"):
- changelog = util.fetch_changelog()
- self.send_channel_msg(tr("update_successful", version=self.version, changelog=changelog))
+ try:
+ if not last_startup_version or version.parse(last_startup_version) < version.parse(self.version):
+ var.db.set("bot", "version", self.version)
+ if var.config.getboolean("bot", "auto_check_update"):
+ changelog = util.fetch_changelog()
+ self.send_channel_msg(tr("update_successful", version=self.version, changelog=changelog))
+ except version.InvalidVersion:
+ pass
# Set the CTRL+C shortcut
def ctrl_caught(self, signal, frame):

View file

@ -1,6 +1,7 @@
{ lib { lib
, stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, python3Packages , python3Packages
, ffmpeg , ffmpeg
, makeWrapper , makeWrapper
@ -53,6 +54,11 @@ stdenv.mkDerivation rec {
# We can't update the package at runtime with NixOS, so this patch makes # We can't update the package at runtime with NixOS, so this patch makes
# the !update command mention that # the !update command mention that
./no-runtime-update.patch ./no-runtime-update.patch
# Fix passing of invalid "git" version into version.parse, which results
# in an InvalidVersion exception. The upstream fix is insufficient, so
# we carry the correct patch downstream for now.
./catch-invalid-versions.patch
]; ];
postPatch = '' postPatch = ''