Fix for compare versions

This commit is contained in:
Dimitris Zlatanidis 2024-04-03 17:38:31 +03:00
parent 1481b9d166
commit da6977fd88

View file

@ -63,6 +63,15 @@ class Upgrade(Configs):
if name not in self.installed_names:
yield name
# def is_package_upgradeable(self, installed: str) -> bool:
# """ Returns True for upgradeable packages. """
# name: str = self.utils.split_package(installed)['name']
# if self.data.get(name):
# repo_package: str = self.data[name]['package']
#
# if installed != repo_package[:-4]:
# return True
def is_package_upgradeable(self, installed: str) -> bool:
""" Returns True for upgradeable packages. """
inst_name: str = self.utils.split_package(installed)['name']
@ -78,7 +87,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.replace('_', '-') > inst_version.replace('_', '-'):
repo_package: str = self.data[inst_name]['package']
if installed != repo_package[:-4]:
return True
self._write_log_file(installed, inst_name, err)
return False