From 0edd631008abfc2a080db98b3aba7db260b1ac66 Mon Sep 17 00:00:00 2001 From: raphael60650 Date: Fri, 3 Sep 2021 22:53:08 +0200 Subject: [PATCH] replaced distutils version by the function get_version_from_string --- source/Gui.py | 9 ++++----- source/definition.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/source/Gui.py b/source/Gui.py index b6ef4c9..eb95251 100644 --- a/source/Gui.py +++ b/source/Gui.py @@ -1,4 +1,3 @@ -from distutils.version import StrictVersion from tkinter import filedialog, ttk, messagebox from tkinter import * import traceback @@ -9,7 +8,7 @@ import os from source.Game import Game, RomAlreadyPatched, InvalidGamePath, InvalidFormat, in_thread, VERSION_FILE_URL from source.Option import Option -from source.definition import sort_version_func +from source.definition import get_version_from_string with open("./translation.json", encoding="utf-8") as f: translation_dict = json.load(f) @@ -26,7 +25,7 @@ class Gui: self.option.load_from_file("./option.json") self.game = Game(gui=self) self.game.ctconfig.load_ctconfig_file("./ct_config.json") - self.game.ctconfig.all_version.sort(key=sort_version_func) + self.game.ctconfig.all_version.sort(key=get_version_from_string) latest_version: str = self.game.ctconfig.all_version[-1] self.is_dev_version = False # Is this installer version a dev ? @@ -164,8 +163,8 @@ class Gui: github_version_data = requests.get(VERSION_FILE_URL, allow_redirects=True).json() with open("./version", "rb") as f: local_version_data = json.load(f) - local_version = StrictVersion(f"{local_version_data['version']}.{local_version_data['subversion']}") - github_version = StrictVersion(f"{github_version_data['version']}.{github_version_data['subversion']}") + local_version = get_version_from_string(f"{local_version_data['version']}.{local_version_data['subversion']}") + github_version = get_version_from_string(f"{github_version_data['version']}.{github_version_data['subversion']}") if github_version > local_version: # if github version is newer than local version if messagebox.askyesno( diff --git a/source/definition.py b/source/definition.py index 97be6f4..7ec7811 100644 --- a/source/definition.py +++ b/source/definition.py @@ -100,7 +100,7 @@ region_id_to_name = { "E": "USA" } -sort_version_func = lambda v: list(map(int, v.split('.'))) +get_version_from_string = lambda v: list(map(int, v.split('.'))) def restart(): """