Fix for compare versions

This commit is contained in:
Dimitris Zlatanidis 2024-04-03 16:43:43 +03:00
parent a0ff730d17
commit 6c5a3cf01c

View file

@ -67,9 +67,9 @@ class Upgrade(Configs):
""" Returns True for upgradeable packages. """ """ Returns True for upgradeable packages. """
inst_name: str = self.utils.split_package(installed)['name'] inst_name: str = self.utils.split_package(installed)['name']
if self.data.get(inst_name): if self.data.get(inst_name):
repo_version: str = self.data[inst_name]['version'] repo_version: str = self.data[inst_name]['version'].replace('_', '-')
repo_build: str = self.data[inst_name]['build'] repo_build: str = self.data[inst_name]['build']
inst_version: str = self.utils.split_package(installed)['version'] inst_version: str = self.utils.split_package(installed)['version'].replace('_', '-')
inst_build: str = self.utils.split_package(installed)['build'] inst_build: str = self.utils.split_package(installed)['build']
try: try:
if parse(repo_version) > parse(inst_version): if parse(repo_version) > parse(inst_version):
@ -78,6 +78,8 @@ class Upgrade(Configs):
if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build): if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build):
return True return True
except InvalidVersion as err: except InvalidVersion as err:
# if repo_version > inst_version:
# return True
self._write_log_file(installed, inst_name, err) self._write_log_file(installed, inst_name, err)
return False return False
return False return False