mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Refactor method for blacklist
This commit is contained in:
parent
9e6ce38274
commit
0db7acdc86
6 changed files with 7 additions and 7 deletions
|
@ -16,7 +16,7 @@ class Blacklist(Configs):
|
|||
super(Configs, self).__init__()
|
||||
self.session = Session
|
||||
|
||||
def get(self) -> None:
|
||||
def packages(self) -> None:
|
||||
""" Reads the blacklist file. """
|
||||
toml_blacks, ponce_blacks = [], []
|
||||
file_toml = Path(self.etc_path, 'blacklist.toml')
|
||||
|
|
|
@ -61,7 +61,7 @@ class Check(Configs, Utilities):
|
|||
packages = []
|
||||
black = Blacklist()
|
||||
|
||||
for package in black.get():
|
||||
for package in black.packages():
|
||||
if package in slackbuilds:
|
||||
packages.append(package)
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class SBoQueries(Configs):
|
|||
self.session = Session
|
||||
|
||||
self.black = Blacklist()
|
||||
if self.name in self.black.get():
|
||||
if self.name in self.black.packages():
|
||||
self.name: str = ''
|
||||
|
||||
def sbos(self) -> list:
|
||||
|
@ -62,7 +62,7 @@ class SBoQueries(Configs):
|
|||
if requires:
|
||||
requires = requires[0].split()
|
||||
for req in requires:
|
||||
if req in self.black.get():
|
||||
if req in self.black.packages():
|
||||
requires.remove(req)
|
||||
return requires
|
||||
return ''
|
||||
|
|
|
@ -20,7 +20,7 @@ class Upgrade(Configs, Utilities):
|
|||
def packages(self):
|
||||
""" Compares version of packages and returns the maximum. """
|
||||
repo_packages = SBoQueries('').sbos()
|
||||
black = self.black.get()
|
||||
black = self.black.packages()
|
||||
upgrade, requires = [], []
|
||||
|
||||
installed = self.all_installed(self.file_pattern)
|
||||
|
|
|
@ -42,7 +42,7 @@ class Utilities:
|
|||
for file in var_log_packages.glob(pattern):
|
||||
package_name = self.split_installed_pkg(file.name)[0]
|
||||
|
||||
if package_name not in self.black.get():
|
||||
if package_name not in self.black.packages():
|
||||
yield file.name
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -6,7 +6,7 @@ class TestBlacklist(unittest.TestCase):
|
|||
|
||||
def test_blacklist(self):
|
||||
black = Blacklist()
|
||||
self.assertListEqual(['%README%'], black.get())
|
||||
self.assertListEqual(['%README%'], black.packages())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue