Updated method

This commit is contained in:
Dimitris Zlatanidis 2023-03-15 20:23:40 +02:00
parent acce9e6e0d
commit 1844b33cf6
3 changed files with 9 additions and 14 deletions

View file

@ -28,16 +28,13 @@ class Check(Configs):
if self.ponce_repo: if self.ponce_repo:
self.repo_path = self.ponce_repo_path self.repo_path = self.ponce_repo_path
def is_package_exists(self, slackbuilds: list) -> list: def exists_in_the_database(self, slackbuilds: list) -> None:
""" Checking if the slackbuild exists in the database. """ """ Checking if the slackbuild exists in the database. """
not_packages: list = [] not_packages: list = []
for sbo in slackbuilds: for sbo in slackbuilds:
if sbo in self.black.packages(): if not SBoQueries(sbo).slackbuild():
slackbuilds.remove(sbo)
elif not SBoQueries(sbo).slackbuild():
not_packages.append(sbo) not_packages.append(sbo)
else: else:
@ -49,8 +46,6 @@ class Check(Configs):
raise SystemExit(f"\n[{self.bred}Error{self.endc}]: Packages " raise SystemExit(f"\n[{self.bred}Error{self.endc}]: Packages "
f"'{self.cyan}{', '.join(not_packages)}{self.endc}' does not exists.\n") f"'{self.cyan}{', '.join(not_packages)}{self.endc}' does not exists.\n")
return slackbuilds
def is_package_unsupported(self, slackbuilds: list) -> None: def is_package_unsupported(self, slackbuilds: list) -> None:
""" Checking for unsupported slackbuilds. """ """ Checking for unsupported slackbuilds. """
for sbo in slackbuilds: for sbo in slackbuilds:

View file

@ -491,7 +491,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
self.check.is_package_unsupported(packages) self.check.is_package_unsupported(packages)
build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command) build = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
@ -510,7 +510,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
self.check.is_package_unsupported(packages) self.check.is_package_unsupported(packages)
install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command) install = Slackbuilds(packages, self.flags, self.file_pattern, mode=command)
@ -529,7 +529,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
download = Download(self.directory, self.flags) download = Download(self.directory, self.flags)
download.packages(packages) download.packages(packages)
raise SystemExit() raise SystemExit()
@ -581,7 +581,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
view = ViewPackage(self.flags) view = ViewPackage(self.flags)
view.package(packages) view.package(packages)
@ -616,7 +616,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
dependees = Dependees(packages, self.flags) dependees = Dependees(packages, self.flags)
dependees.slackbuilds() dependees.slackbuilds()
@ -634,7 +634,7 @@ class Argparse(Configs):
packages: list = self.choose_packages(packages, command) packages: list = self.choose_packages(packages, command)
self.check.is_empty_database() self.check.is_empty_database()
packages: list = self.check.is_package_exists(packages) self.check.exists_in_the_database(packages)
tracking = Tracking(self.flags) tracking = Tracking(self.flags)
tracking.packages(packages) tracking.packages(packages)

View file

@ -12,7 +12,7 @@ class TestPkgInstalled(unittest.TestCase):
self.packages = ['fish', 'ranger', 'pycharm'] self.packages = ['fish', 'ranger', 'pycharm']
def test_check_exists(self): def test_check_exists(self):
self.assertIsNone(self.check.is_package_exists(self.packages)) self.assertIsNone(self.check.exists_in_the_database(self.packages))
def test_check_unsupported(self): def test_check_unsupported(self):
self.assertIsNone(self.check.is_package_unsupported(self.packages)) self.assertIsNone(self.check.is_package_unsupported(self.packages))