diff --git a/slpkg/choose_packages.py b/slpkg/choose_packages.py index e2b1c468..6b500822 100644 --- a/slpkg/choose_packages.py +++ b/slpkg/choose_packages.py @@ -62,20 +62,26 @@ class Choose(Configs): def choose_for_upgraded(self, data: dict, packages: list): """ Choose packages that they will going to upgrade. """ - for pkg in packages: - for package in data.keys(): + for package in packages: + # for package in data.keys(): - if pkg == package: - 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'] + 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'] - 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_version: + inst_package_version: str = 'None' + if not inst_package_build: + inst_package_build: str = 'None' + + repo_ver: str = data[package]['version'] + repo_build_tag: str = data[package]['build'] + + 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): """ Choose packages for others methods like install, tracking etc. """