mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Refactor query names
This commit is contained in:
parent
727b90fcea
commit
86ab4deecd
6 changed files with 8 additions and 8 deletions
|
@ -74,6 +74,6 @@ class Check:
|
||||||
def database(self):
|
def database(self):
|
||||||
""" Checking for empty table """
|
""" Checking for empty table """
|
||||||
db = f'{self.configs.db_path}/{self.configs.database}'
|
db = f'{self.configs.db_path}/{self.configs.database}'
|
||||||
if not SBoQueries('').names() or not os.path.isfile(db):
|
if not SBoQueries('').sbos() or not os.path.isfile(db):
|
||||||
raise SystemExit('\nYou need to update the package lists first.\n'
|
raise SystemExit('\nYou need to update the package lists first.\n'
|
||||||
'Please run slpkg update.\n')
|
'Please run slpkg update.\n')
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Dependees:
|
||||||
dependees = {}
|
dependees = {}
|
||||||
for package in self.packages:
|
for package in self.packages:
|
||||||
found = [] # Reset list every package
|
found = [] # Reset list every package
|
||||||
sbos = SBoQueries('').names()
|
sbos = SBoQueries('').sbos()
|
||||||
|
|
||||||
for sbo in sbos:
|
for sbo in sbos:
|
||||||
requires = SBoQueries(sbo).requires()
|
requires = SBoQueries(sbo).requires()
|
||||||
|
|
|
@ -20,10 +20,10 @@ class SBoQueries:
|
||||||
if self.name in self.black.get():
|
if self.name in self.black.get():
|
||||||
self.name = ''
|
self.name = ''
|
||||||
|
|
||||||
def names(self) -> list:
|
def sbos(self) -> list:
|
||||||
""" Returns all the slackbuilds. """
|
""" Returns all the slackbuilds. """
|
||||||
names = self.session.query(SBoTable.name).all()
|
sbos = self.session.query(SBoTable.name).all()
|
||||||
return [name[0] for name in names]
|
return [sbo[0] for sbo in sbos]
|
||||||
|
|
||||||
def slackbuild(self) -> str:
|
def slackbuild(self) -> str:
|
||||||
""" Returns a slackbuild. """
|
""" Returns a slackbuild. """
|
||||||
|
|
|
@ -19,7 +19,7 @@ class SearchPackage:
|
||||||
endc = color['endc']
|
endc = color['endc']
|
||||||
matching = 0
|
matching = 0
|
||||||
|
|
||||||
names = SBoQueries('').names()
|
names = SBoQueries('').sbos()
|
||||||
|
|
||||||
print(f'The list below shows the repo '
|
print(f'The list below shows the repo '
|
||||||
f'packages that contains \'{", ".join([p for p in packages])}\' files:\n')
|
f'packages that contains \'{", ".join([p for p in packages])}\' files:\n')
|
||||||
|
|
|
@ -19,7 +19,7 @@ class Upgrade:
|
||||||
|
|
||||||
def packages(self):
|
def packages(self):
|
||||||
""" Compares version of packages and returns the maximum. """
|
""" Compares version of packages and returns the maximum. """
|
||||||
repo_packages = SBoQueries('').names()
|
repo_packages = SBoQueries('').sbos()
|
||||||
black = Blacklist().get()
|
black = Blacklist().get()
|
||||||
|
|
||||||
for pkg in os.listdir(self.configs.log_packages):
|
for pkg in os.listdir(self.configs.log_packages):
|
||||||
|
|
|
@ -35,7 +35,7 @@ class TestSBoQueries(unittest.TestCase):
|
||||||
self.query.description())
|
self.query.description())
|
||||||
|
|
||||||
def test_names(self):
|
def test_names(self):
|
||||||
self.assertIn('slpkg', self.query.names())
|
self.assertIn('slpkg', self.query.sbos())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue