From 554fca58ce16a4441351a8e526b67db64cdd3552 Mon Sep 17 00:00:00 2001 From: Christoph Miksche Date: Sun, 19 May 2019 17:32:10 +0200 Subject: [PATCH] Add version comparision from packaging --- functions.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/functions.py b/functions.py index 3f13e99..ff4af26 100644 --- a/functions.py +++ b/functions.py @@ -34,21 +34,12 @@ def buildFromSource(tag): # Move binary os.system("mv gitea "+settings.gtfile) -# Function to create a list from a version string -def getVersionList(string): - return list(map(int, string.split('.'))) - - # Function to check if there is a new version def checkVersion(new_version, old_version): - new_version_list = getVersionList(new_version) - old_version_list = getVersionList(old_version) - for id, val in enumerate(new_version_list): - if val > old_version_list[id]: - return True + from packaging import version - return None + return version.parse(new_version) > version.parse(old_version) # Function to check if tool is available def is_tool(name):