Switch for inheritance

This commit is contained in:
Dimitris Zlatanidis 2023-01-23 21:28:00 +02:00
parent 0fb7046732
commit 68f28caaab

View file

@ -8,12 +8,12 @@ from slpkg.dependencies import Requires
from slpkg.configs import Configs
class Upgrade:
class Upgrade(Configs, Utilities):
""" Upgrade the installed packages. """
def __init__(self):
self.utils = Utilities()
self.conf = Configs()
super(Configs, self).__init__()
super(Utilities, self).__init__()
def packages(self):
""" Compares version of packages and returns the maximum. """
@ -21,14 +21,14 @@ class Upgrade:
black = Blacklist().get()
upgrade, requires = [], []
installed = self.utils.all_installed(f'*{self.conf.sbo_repo_tag}')
installed = self.all_installed(f'*{self.sbo_repo_tag}')
for pkg in installed:
inst_pkg_name = self.utils.split_installed_pkg(pkg)[0]
inst_pkg_name = self.split_installed_pkg(pkg)[0]
if inst_pkg_name not in black and inst_pkg_name in repo_packages:
if self.utils.is_repo_version_bigger(inst_pkg_name):
if self.is_repo_version_bigger(inst_pkg_name):
requires += Requires(inst_pkg_name).resolve()
upgrade.append(inst_pkg_name)