Fix for compare versions

This commit is contained in:
Dimitris Zlatanidis 2024-04-03 16:49:10 +03:00
parent 6c5a3cf01c
commit 1481b9d166

View file

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