From e6e08b87f0a586a41ad61e65716136d3eab4a0d5 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 9 May 2023 21:24:49 +0300 Subject: [PATCH] Updated for naming --- slpkg/upgrade.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index eb64342b..872c2dbd 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -35,39 +35,39 @@ class Upgrade(Configs): # Returns the matched packages between two lists. packages: tuple = tuple(set(self.utils.installed_packages.keys()) & set(self.data.keys())) - for pkg in packages: - if self.is_package_upgradeable(pkg): - yield pkg + for package in packages: + if self.is_package_upgradeable(package): + yield package def is_package_upgradeable(self, name: str) -> bool: """ Compares version of packages and returns the maximum. """ - repo_version = repo_build = '0' - inst_version = inst_build = '0' + repo_package_version = repo_package_build = '0' + inst_package_version = inst_package_build = '0' inst_package: str = self.utils.is_package_installed(name) if inst_package and inst_package.endswith(self.repos.repositories[self.repository][6]): - inst_version: str = self.utils.split_binary_pkg(inst_package)[1] - inst_build: str = self.utils.split_binary_pkg(inst_package)[3] + inst_package_version: str = self.utils.split_binary_pkg(inst_package)[1] + inst_package_build: str = self.utils.split_binary_pkg(inst_package)[3] if self.is_binary and self.data.get(name): - repo_version: str = self.data[name][0] + repo_package_version: str = self.data[name][0] repo_package: str = self.data[name][1] - repo_build: str = self.utils.split_binary_pkg(repo_package)[3] + repo_package_build: str = self.utils.split_binary_pkg(repo_package)[3] else: - repo_version: str = self.data[name][2] + repo_package_version: str = self.data[name][2] repo_location: str = self.data[name][0] - repo_build: str = self.utils.read_slackbuild_build_tag( + repo_package_build: str = self.utils.read_slackbuild_build_tag( name, repo_location, self.repository) - repo_pkg: str = f'{name}-{repo_version}' - inst_pkg: str = f'{name}-{inst_version}' + repository_package: str = f'{name}-{repo_package_version}' + installed_package: str = f'{name}-{inst_package_version}' try: - if parse(repo_pkg) > parse(inst_pkg): + if parse(repository_package) > parse(installed_package): return True - if (parse(repo_pkg) == parse(inst_pkg) - and parse(repo_build) > parse(inst_build)): + if (parse(repository_package) == parse(installed_package) + and parse(repo_package_build) > parse(inst_package_build)): return True except InvalidVersion: @@ -75,13 +75,13 @@ class Upgrade(Configs): logger.exception(f'{self.__class__.__name__}: ' f'{self.__class__.is_package_upgradeable.__name__}: ' f'{self.repos.repositories[self.repository][6]}, ' - f'{repo_pkg=}, {inst_pkg=}, {repo_pkg > inst_pkg}, ' - f'{repo_pkg == inst_pkg and repo_build > inst_build}') + f'{repository_package=}, {installed_package=}, {repository_package > installed_package}, ' + f'{repository_package == installed_package and repo_package_build > inst_package_build}') - if repo_pkg > inst_pkg: + if repository_package > installed_package: return True - if repo_pkg == inst_pkg and repo_build > inst_build: + if repository_package == installed_package and repo_package_build > inst_package_build: return True return False