Fixed for none version

This commit is contained in:
Dimitris Zlatanidis 2023-03-07 18:02:55 +02:00
parent 17ee1e3181
commit df87c04ac5

View file

@ -7,6 +7,7 @@ import tarfile
from pathlib import Path
from typing import Generator, Any
from distutils.version import LooseVersion
# from packaging.version import Version
from slpkg.configs import Configs
from slpkg.queries import SBoQueries
@ -94,12 +95,17 @@ class Utilities:
def is_package_upgradeable(self, package: str, file_pattern: str) -> Any:
""" Checks if the package is installed and if it is upgradeable, returns true. """
installed_version: str = '0'
installed = self.is_package_installed(package, file_pattern)
repository_version = SBoQueries(package).version()
if not repository_version:
repository_version: str = '0'
if installed:
installed_version = self.split_installed_pkg(installed)[1]
repository_version = SBoQueries(package).version()
return LooseVersion(repository_version) > LooseVersion(installed_version)
return LooseVersion(repository_version) > LooseVersion(installed_version)
@staticmethod
def is_option(flag: list, flags: list) -> Any: