Fixed for empty list

This commit is contained in:
Dimitris Zlatanidis 2022-12-24 22:40:45 +02:00
parent 03dfbfedc8
commit f42e57f9a6

View file

@ -57,21 +57,22 @@ class Upgrade:
def packages(self):
""" Choose packages for upgrade. """
choices = []
packages = self.search()
packages = list(self.search())
for package in packages:
pkg = self.utils.is_installed(package)
inst_ver = self.utils.split_installed_pkg(pkg)[1]
repo_ver = SBoQueries(package).version()
choices += [(package, f'{inst_ver} -> {repo_ver}', True)]
if packages:
for package in packages:
pkg = self.utils.is_installed(package)
inst_ver = self.utils.split_installed_pkg(pkg)[1]
repo_ver = SBoQueries(package).version()
choices += [(package, f'{inst_ver} -> {repo_ver}', True)]
code, tags = self.d.checklist(f'There are {len(choices)} packages for upgrade:',
title='Choose packages you want to upgrade',
height=10, width=70, list_height=0, choices=choices)
os.system('clear')
if code == self.d.OK:
if not tags:
raise SystemExit()
return tags
code, tags = self.d.checklist(f'There are {len(choices)} packages for upgrade:',
title='Choose packages you want to upgrade',
height=10, width=70, list_height=0, choices=choices)
os.system('clear')
if code == self.d.OK:
if not tags:
raise SystemExit()
return tags
raise SystemExit()
raise SystemExit()