From 338554035034542a1d29d8afdeb5b23b1f8e3648 Mon Sep 17 00:00:00 2001 From: piair Date: Tue, 4 Apr 2023 20:50:56 +0200 Subject: [PATCH] better way if manually updated --- main.py | 6 ++++-- requirements.txt | 3 ++- version | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 37953fc..6e8658c 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ #/usr/bin/python3.10 - +from packaging.version import parse as parse_version import configparser import os import shutil @@ -157,13 +157,15 @@ def proxy() : def check_update(): try : latest = requests.get("https://api.github.com/repos/piair338/MsRewards/releases").json()[0]["tag_name"] + latest = parse_version(latest) except Exception as e : print(e) return () f = open("./version", 'r') txt = f.readlines()[0].replace("\n","") f.close() - if (txt == latest) : + cur = parse_version(txt) + if (cur < latest) : print("Already up to date.") else : print(f"updating to {latest}") diff --git a/requirements.txt b/requirements.txt index 5984d25..4565d6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ requests pyvirtualdisplay pillow EasyProcess -pyotp \ No newline at end of file +pyotp +packaging diff --git a/version b/version index 346d9ca..96f3123 100644 --- a/version +++ b/version @@ -1 +1 @@ -v5.1.1 +v5.1.2