mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-25 09:58:41 +01:00
Updated for new added packages
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
9de0813d56
commit
ded1282381
2 changed files with 14 additions and 7 deletions
|
@ -9,7 +9,7 @@ from slpkg.utilities import Utilities
|
|||
from slpkg.dialog_box import DialogBox
|
||||
|
||||
|
||||
class Choose(Configs):
|
||||
class Choose(Configs): # pylint: disable=[R0902]
|
||||
"""Choose packages with dialog utility and -S, --search flag."""
|
||||
|
||||
def __init__(self, repository: str):
|
||||
|
@ -23,8 +23,9 @@ class Choose(Configs):
|
|||
self.height: int = 10
|
||||
self.width: int = 70
|
||||
self.list_height: int = 0
|
||||
self.ordered: bool = True
|
||||
|
||||
def packages(self, data: dict, packages: list, method: str) -> list:
|
||||
def packages(self, data: dict, packages: list, method: str, ordered: bool = True) -> list:
|
||||
"""Call methods to choosing packages via dialog tool.
|
||||
|
||||
Args:
|
||||
|
@ -38,6 +39,7 @@ class Choose(Configs):
|
|||
Raises:
|
||||
SystemExit: Exit code 0.
|
||||
"""
|
||||
self.ordered: bool = ordered
|
||||
if self.dialog:
|
||||
title: str = f' Choose packages you want to {method} '
|
||||
|
||||
|
@ -74,7 +76,10 @@ class Choose(Configs):
|
|||
|
||||
def choose_for_upgraded(self, data: dict, packages: list) -> None:
|
||||
"""Choose packages that they will going to upgrade."""
|
||||
for package in sorted(packages):
|
||||
if self.ordered:
|
||||
packages: list = sorted(packages)
|
||||
|
||||
for package in packages:
|
||||
|
||||
inst_package: str = self.utils.is_package_installed(package)
|
||||
inst_package_version: str = self.utils.split_package(inst_package)['version']
|
||||
|
|
|
@ -450,6 +450,7 @@ class Menu(Configs): # pylint: disable=[R0902]
|
|||
command: str = Menu.upgrade.__name__
|
||||
removed: list = []
|
||||
added: list = []
|
||||
ordered: bool = True
|
||||
|
||||
if len(self.args) == 1:
|
||||
|
||||
|
@ -475,13 +476,14 @@ class Menu(Configs): # pylint: disable=[R0902]
|
|||
remove = RemovePackages(removed, self.flags)
|
||||
remove.remove(upgrade=True)
|
||||
|
||||
# New packages added to the repository are pushed to the front of
|
||||
# the list to be installed first.
|
||||
# If new packages are added to the repository, the sorted list will be disabled
|
||||
# and the new packages will be pushed to the front of the list to be installed first.
|
||||
if added:
|
||||
packages = [pkg for pkg in packages if not pkg.endswith('_Added.')]
|
||||
packages: list = added.extend(packages)
|
||||
packages: list = added + packages
|
||||
ordered: bool = False
|
||||
|
||||
packages: list = self.choose.packages(self.data, packages, command)
|
||||
packages: list = self.choose.packages(self.data, packages, command, ordered)
|
||||
|
||||
if not packages:
|
||||
print('\nEverything is up-to-date!\n')
|
||||
|
|
Loading…
Reference in a new issue