Updated for blacklist

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2022-11-23 17:05:30 +02:00
parent 0acbf687b5
commit d5bca75e53
2 changed files with 8 additions and 13 deletions

View file

@ -49,14 +49,17 @@ class Check:
raise SystemExit('\nNot found installed packages.\n') raise SystemExit('\nNot found installed packages.\n')
def blacklist(self, slackbuilds: list): def blacklist(self, slackbuilds: list):
''' Checking for packages on the blacklist and removing them. ''' ''' Checking if the packages are blacklisted. '''
packages = []
black = Blacklist() black = Blacklist()
for package in black.get(): for package in black.get():
if package in slackbuilds: if package in slackbuilds:
slackbuilds.remove(package) packages.append(package)
return slackbuilds if packages:
raise SystemExit(
f'\nThe package \'{", ".join(packages)}\' is blacklisted.\n')
def database(self): def database(self):
''' Checking for empty table ''' ''' Checking for empty table '''

View file

@ -33,6 +33,8 @@ class Argparse:
if len(self.args) == 0: if len(self.args) == 0:
usage(1) usage(1)
self.check.blacklist(self.args)
def flag(self): def flag(self):
self.flags = [] self.flags = []
@ -140,9 +142,6 @@ class Argparse:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
self.check.installed(packages) self.check.installed(packages)
remove = RemovePackages(packages, self.flags) remove = RemovePackages(packages, self.flags)
@ -155,9 +154,6 @@ class Argparse:
packages = list(set(self.args[1:])) packages = list(set(self.args[1:]))
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
self.check.exists(packages) self.check.exists(packages)
view = ViewPackage() view = ViewPackage()
@ -171,8 +167,6 @@ class Argparse:
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
search = SearchPackage() search = SearchPackage()
search.package(packages) search.package(packages)
raise SystemExit() raise SystemExit()
@ -184,8 +178,6 @@ class Argparse:
self.check.database() self.check.database()
packages = self.check.blacklist(packages)
find = FindInstalled() find = FindInstalled()
find.find(packages) find.find(packages)
raise SystemExit() raise SystemExit()