mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-11 16:37:21 +01:00
Add version comparision from packaging
This commit is contained in:
13
functions.py
13
functions.py
@@ -34,21 +34,12 @@ def buildFromSource(tag):
|
|||||||
# Move binary
|
# Move binary
|
||||||
os.system("mv gitea "+settings.gtfile)
|
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
|
# Function to check if there is a new version
|
||||||
def checkVersion(new_version, old_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):
|
from packaging import version
|
||||||
if val > old_version_list[id]:
|
|
||||||
return True
|
|
||||||
|
|
||||||
return None
|
return version.parse(new_version) > version.parse(old_version)
|
||||||
|
|
||||||
# Function to check if tool is available
|
# Function to check if tool is available
|
||||||
def is_tool(name):
|
def is_tool(name):
|
||||||
|
|||||||
Reference in New Issue
Block a user