Moved to main

This commit is contained in:
Dimitris Zlatanidis 2022-12-26 09:22:15 +02:00
parent ccd9aa8af9
commit 51a9abbbf5
2 changed files with 13 additions and 34 deletions

View file

@ -84,8 +84,15 @@ class Argparse:
for package in repo_packages:
for pkg in packages:
if pkg in package:
repo_ver = SBoQueries(package).version()
choices += [(package, repo_ver, False)]
if method == 'upgrade':
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)]
else:
repo_ver = SBoQueries(package).version()
choices += [(package, repo_ver, False)]
text = f'There are {len(choices)} packages:'
@ -134,7 +141,9 @@ class Argparse:
self.check.database()
upgrade = Upgrade()
packages = upgrade.packages()
packages = list(upgrade.packages())
packages = self.choose_packages(packages, Argparse.upgrade.__name__)
if not packages:
print('\nEverything is up-to-date.\n')

View file

@ -21,7 +21,7 @@ class Upgrade:
self.utils = Utilities()
self.dialog = DialogBox()
def search(self):
def packages(self):
""" Compares version of packages and returns the maximum. """
repo_packages = SBoQueries('').sbos()
black = Blacklist().get()
@ -45,33 +45,3 @@ class Upgrade:
for pkg in upgrade:
if pkg not in requires:
yield pkg
def packages(self):
""" Choose packages for upgrade. """
height = 10
width = 70
list_height = 0
choices = []
title = ' Choose packages you want to upgrade '
packages = list(self.search())
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)]
text = f'There are {len(choices)} packages for upgrade:'
code, tags = self.dialog.checklist(text, title, height, width, list_height, choices, packages)
if not code:
return packages
os.system('clear')
if not tags:
raise SystemExit()
return tags