Updated utils

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-02-16 17:33:42 +01:00
parent 20a175f6e0
commit 254d19314c
2 changed files with 9 additions and 11 deletions

View file

@ -29,7 +29,7 @@ from slpkg.splitting import split_package
from slpkg.__metadata__ import MetaData as _meta_ from slpkg.__metadata__ import MetaData as _meta_
class BlackList: class BlackList(Utils):
"""Blacklist class to add, remove or listed packages """Blacklist class to add, remove or listed packages
in blacklist file.""" in blacklist file."""
def __init__(self): def __init__(self):
@ -39,7 +39,7 @@ class BlackList:
self.blackfile = "/etc/slpkg/blacklist" self.blackfile = "/etc/slpkg/blacklist"
self.black_conf = "" self.black_conf = ""
if os.path.isfile(self.blackfile): 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): def get_black(self):
"""Return blacklist packages from /etc/slpkg/blacklist """Return blacklist packages from /etc/slpkg/blacklist

View file

@ -25,7 +25,6 @@
import os import os
from pkg_resources import parse_version from pkg_resources import parse_version
from slpkg.utils import Utils from slpkg.utils import Utils
from slpkg.messages import Msg from slpkg.messages import Msg
from slpkg.log_deps import write_deps 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 from slpkg.sbo.slack_find import slack_package
class SBoInstall(BlackList): class SBoInstall(BlackList, Utils):
"""Build and install SBo packages with all dependencies """Build and install SBo packages with all dependencies
""" """
def __init__(self, slackbuilds, flag): def __init__(self, slackbuilds, flag):
@ -63,7 +62,6 @@ class SBoInstall(BlackList):
self.grey = _meta_.color["GREY"] self.grey = _meta_.color["GREY"]
self.endc = _meta_.color["ENDC"] self.endc = _meta_.color["ENDC"]
self.msg = Msg() self.msg = Msg()
self.utils = Utils()
self.arch = SBoArch().get() self.arch = SBoArch().get()
self.build_folder = self.meta.build_path self.build_folder = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES self._SOURCES = self.meta.SBo_SOURCES
@ -174,7 +172,7 @@ class SBoInstall(BlackList):
lowercase lowercase
""" """
if "--case-ins" in self.flag: 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: for name in self.slackbuilds:
index = self.slackbuilds.index(name) index = self.slackbuilds.index(name)
for key, value in data_dict.items(): for key, value in data_dict.items():
@ -185,8 +183,8 @@ class SBoInstall(BlackList):
"""Update dependencies dictionary with all package """Update dependencies dictionary with all package
""" """
onelist, dependencies = [], [] onelist, dependencies = [], []
onelist = self.utils.dimensional_list(self.deps) onelist = self.dimensional_list(self.deps)
dependencies = self.utils.remove_dbs(onelist) dependencies = self.remove_dbs(onelist)
for dep in dependencies: for dep in dependencies:
deps = Requires(self.flag).sbo(dep) deps = Requires(self.flag).sbo(dep)
self.deps_dict[dep] = self.one_for_all(deps) self.deps_dict[dep] = self.one_for_all(deps)
@ -214,7 +212,7 @@ class SBoInstall(BlackList):
"""Clear master slackbuilds if already exist in dependencies """Clear master slackbuilds if already exist in dependencies
or if added to install two or more times 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: for mas in self.master_packages:
if mas in self.dependencies: if mas in self.dependencies:
self.master_packages.remove(mas) self.master_packages.remove(mas)
@ -247,8 +245,8 @@ class SBoInstall(BlackList):
deps.reverse() deps.reverse()
# Inverting the list brings the # Inverting the list brings the
# dependencies in order to be installed. # dependencies in order to be installed.
requires = self.utils.dimensional_list(deps) requires = self.dimensional_list(deps)
dependencies = self.utils.remove_dbs(requires) dependencies = self.remove_dbs(requires)
return dependencies return dependencies
def top_view(self): def top_view(self):