mirror of
https://github.com/CMiksche/gitea-auto-update
synced 2025-12-10 16:07:23 +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
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user