diff --git a/slpkg/checks.py b/slpkg/checks.py index f57e9413..c9bf38ff 100644 --- a/slpkg/checks.py +++ b/slpkg/checks.py @@ -49,14 +49,17 @@ class Check: raise SystemExit('\nNot found installed packages.\n') def blacklist(self, slackbuilds: list): - ''' Checking for packages on the blacklist and removing them. ''' + ''' Checking if the packages are blacklisted. ''' + packages = [] black = Blacklist() for package in black.get(): 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): ''' Checking for empty table ''' diff --git a/slpkg/main.py b/slpkg/main.py index 80094cd1..fcbac2a6 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -33,6 +33,8 @@ class Argparse: if len(self.args) == 0: usage(1) + self.check.blacklist(self.args) + def flag(self): self.flags = [] @@ -140,9 +142,6 @@ class Argparse: packages = list(set(self.args[1:])) self.check.database() - - packages = self.check.blacklist(packages) - self.check.installed(packages) remove = RemovePackages(packages, self.flags) @@ -155,9 +154,6 @@ class Argparse: packages = list(set(self.args[1:])) self.check.database() - - packages = self.check.blacklist(packages) - self.check.exists(packages) view = ViewPackage() @@ -171,8 +167,6 @@ class Argparse: self.check.database() - packages = self.check.blacklist(packages) - search = SearchPackage() search.package(packages) raise SystemExit() @@ -184,8 +178,6 @@ class Argparse: self.check.database() - packages = self.check.blacklist(packages) - find = FindInstalled() find.find(packages) raise SystemExit()