diff --git a/slpkg/utilities.py b/slpkg/utilities.py index 1c681171..d41eabb1 100644 --- a/slpkg/utilities.py +++ b/slpkg/utilities.py @@ -7,8 +7,7 @@ import shutil import subprocess from pathlib import Path from typing import Generator, Any, Union -from distutils.version import LooseVersion -# from packaging.version import Version +from packaging.version import parse from slpkg.configs import Configs from slpkg.sbos.queries import SBoQueries @@ -38,9 +37,8 @@ class Utilities: def is_package_installed(self, name: str) -> str: """ Returns the installed package name. """ for package_name in self.installed_package_names: - if package_name == name: - return package_name + return name return '' @@ -127,8 +125,7 @@ class Utilities: if installed: installed_version: str = self.split_binary_pkg(installed)[1] - return (str(LooseVersion(f'{repository_version}.{repo_build_tag}')) > - str(LooseVersion(f'{installed_version}.{inst_build_tag}'))) + return parse(repository_version + repo_build_tag) > parse(installed_version + inst_build_tag) def read_build_tag(self, sbo: str) -> str: """ Patching SBo TAG from the configuration file. """