From 254d19314c740eea86a759665164ba550793daf0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 16 Feb 2020 17:33:42 +0100 Subject: [PATCH] Updated utils Signed-off-by: Dimitris Zlatanidis --- slpkg/blacklist.py | 4 ++-- slpkg/sbo/slackbuild.py | 16 +++++++--------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/slpkg/blacklist.py b/slpkg/blacklist.py index 685b59a6..425d7870 100644 --- a/slpkg/blacklist.py +++ b/slpkg/blacklist.py @@ -29,7 +29,7 @@ from slpkg.splitting import split_package from slpkg.__metadata__ import MetaData as _meta_ -class BlackList: +class BlackList(Utils): """Blacklist class to add, remove or listed packages in blacklist file.""" def __init__(self): @@ -39,7 +39,7 @@ class BlackList: self.blackfile = "/etc/slpkg/blacklist" self.black_conf = "" if os.path.isfile(self.blackfile): - self.black_conf = Utils().read_file(self.blackfile) + self.black_conf = self.read_file(self.blackfile) def get_black(self): """Return blacklist packages from /etc/slpkg/blacklist diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 684be808..78021dc3 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -25,7 +25,6 @@ import os from pkg_resources import parse_version - from slpkg.utils import Utils from slpkg.messages import Msg from slpkg.log_deps import write_deps @@ -48,7 +47,7 @@ from slpkg.sbo.search import sbo_search_pkg from slpkg.sbo.slack_find import slack_package -class SBoInstall(BlackList): +class SBoInstall(BlackList, Utils): """Build and install SBo packages with all dependencies """ def __init__(self, slackbuilds, flag): @@ -63,7 +62,6 @@ class SBoInstall(BlackList): self.grey = _meta_.color["GREY"] self.endc = _meta_.color["ENDC"] self.msg = Msg() - self.utils = Utils() self.arch = SBoArch().get() self.build_folder = self.meta.build_path self._SOURCES = self.meta.SBo_SOURCES @@ -174,7 +172,7 @@ class SBoInstall(BlackList): lowercase """ if "--case-ins" in self.flag: - data_dict = self.utils.case_sensitive(self.data) + data_dict = self.case_sensitive(self.data) for name in self.slackbuilds: index = self.slackbuilds.index(name) for key, value in data_dict.items(): @@ -185,8 +183,8 @@ class SBoInstall(BlackList): """Update dependencies dictionary with all package """ onelist, dependencies = [], [] - onelist = self.utils.dimensional_list(self.deps) - dependencies = self.utils.remove_dbs(onelist) + onelist = self.dimensional_list(self.deps) + dependencies = self.remove_dbs(onelist) for dep in dependencies: deps = Requires(self.flag).sbo(dep) self.deps_dict[dep] = self.one_for_all(deps) @@ -214,7 +212,7 @@ class SBoInstall(BlackList): """Clear master slackbuilds if already exist in dependencies or if added to install two or more times """ - self.master_packages = self.utils.remove_dbs(self.master_packages) + self.master_packages = self.remove_dbs(self.master_packages) for mas in self.master_packages: if mas in self.dependencies: self.master_packages.remove(mas) @@ -247,8 +245,8 @@ class SBoInstall(BlackList): deps.reverse() # Inverting the list brings the # dependencies in order to be installed. - requires = self.utils.dimensional_list(deps) - dependencies = self.utils.remove_dbs(requires) + requires = self.dimensional_list(deps) + dependencies = self.remove_dbs(requires) return dependencies def top_view(self):