Merge pull request #11 from adator85/dev

convert version string to int
This commit is contained in:
adator
2024-08-03 20:25:37 +02:00
committed by GitHub
2 changed files with 26 additions and 24 deletions

View File

@@ -77,7 +77,7 @@ class Base:
self.logs.warning(f'Github not available to fetch latest version')
def check_for_new_version(self) -> bool:
try:
# Assigner la version actuelle de Defender
self.__set_current_defender_version()
# Récuperer la dernier version disponible dans github
@@ -90,19 +90,21 @@ class Base:
curr_major , curr_minor, curr_patch = current_version.split('.')
last_major, last_minor, last_patch = latest_version.split('.')
if last_major > curr_major:
if int(last_major) > int(curr_major):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif last_major == curr_major and last_minor > curr_minor:
elif int(last_major) == int(curr_major) and int(last_minor) > int(curr_minor):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
elif last_major == curr_major and last_minor == curr_minor and last_patch > curr_patch:
elif int(last_major) == int(curr_major) and int(last_minor) == int(curr_minor) and int(last_patch) > int(curr_patch):
self.logs.info(f'New version available: {current_version} >>> {latest_version}')
isNewVersion = True
else:
isNewVersion = False
return isNewVersion
except ValueError as ve:
self.logs.error(f'Impossible to convert in version number : {ve}')
def get_unixtime(self) -> int:
"""

View File

@@ -1,3 +1,3 @@
{
"version": "4.0.1"
"version": "4.0.2"
}