From 7eeecaf84115be78e3c84a0fce64671454669d2a Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 17 Jun 2022 22:27:09 +0300 Subject: [PATCH] Check for empty database --- slpkg/main.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/slpkg/main.py b/slpkg/main.py index 8572f8b7..cdad6781 100644 --- a/slpkg/main.py +++ b/slpkg/main.py @@ -23,6 +23,7 @@ class Check: def exists(self): ''' Checking if the slackbuild exists in the repository. ''' + self.database() for sbo in self.slackbuilds: if not SBoQueries(sbo).slackbuild(): raise SystemExit(f'Error: Package {sbo} does not exists.') @@ -43,6 +44,12 @@ class Check: return raise SystemExit('Error: Not found packages for remove.') + def database(self): + ''' Checking for empty table ''' + if not SBoQueries('').names(): + raise SystemExit('\nYou need to update the package lists first.\n' + 'Please run slpkg update.\n') + @dataclass class Argparse: