Updated for sorted

This commit is contained in:
Dimitris Zlatanidis 2024-04-11 12:56:37 +03:00
parent 76128d816f
commit f9dd3d6fdc

View file

@ -54,36 +54,35 @@ class Choose(Configs):
for name, package in self.utils.all_installed().items():
version: str = self.utils.split_package(package)['version']
for pkg in packages:
for pkg in sorted(packages):
if pkg in name or pkg == '*':
self.choices.extend([(name, version, False, f'Package: {package}')])
def choose_for_upgraded(self, data: dict, packages: list) -> None:
""" Choose packages that they will going to upgrade. """
for package in packages:
for package in sorted(packages):
if package in data.keys():
inst_package: str = self.utils.is_package_installed(package)
inst_package_version: str = self.utils.split_package(inst_package)['version']
inst_package_build: str = self.utils.split_package(inst_package)['build']
inst_package: str = self.utils.is_package_installed(package)
inst_package_version: str = self.utils.split_package(inst_package)['version']
inst_package_build: str = self.utils.split_package(inst_package)['build']
repo_ver: str = data[package]['version']
repo_build_tag: str = data[package]['build']
repo_ver: str = data[package]['version']
repo_build_tag: str = data[package]['build']
if not inst_package_version:
self.choices.extend(
[(package, f'None -> {repo_ver}', True,
f'Installed: None -> Available: {repo_ver} Build: {repo_build_tag}')])
else:
self.choices.extend(
[(package, f'{inst_package_version} -> {repo_ver}', True,
f'Installed: {package}-{inst_package_version} Build: {inst_package_build} -> '
f'Available: {repo_ver} Build: {repo_build_tag}')])
if not inst_package:
self.choices.extend(
[(package, f'None -> {repo_ver}', True,
f'Installed: None -> Available: {repo_ver} Build: {repo_build_tag}')])
else:
self.choices.extend(
[(package, f'{inst_package_version} -> {repo_ver}', True,
f'Installed: {package}-{inst_package_version} Build: {inst_package_build} -> '
f'Available: {repo_ver} Build: {repo_build_tag}')])
def choose_for_others(self, data: dict, packages: list) -> None:
""" Choose packages for others methods like install, tracking etc. """
if self.repository == '*':
for pkg in packages:
for pkg in sorted(packages):
for repo_name, repo_data in data.items():
for package in repo_data.keys():
if pkg in package or pkg == '*':
@ -92,7 +91,7 @@ class Choose(Configs):
f'> {repo_name}')])
else:
for pkg in packages:
for pkg in sorted(packages):
for package in data.keys():
if pkg in package or pkg == '*':
version: str = data[package]['version']