From 83e1a48180ab84be2df6360da947ebbf5ef0ddd1 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Fri, 31 May 2024 17:09:16 +0300 Subject: [PATCH] Added colors to log file Signed-off-by: Dimitris Zlatanidis --- slpkg/upgrade.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/slpkg/upgrade.py b/slpkg/upgrade.py index 0c6669d3..6f1a7e05 100644 --- a/slpkg/upgrade.py +++ b/slpkg/upgrade.py @@ -121,13 +121,10 @@ class Upgrade(Configs): # pylint: disable=[R0902] if parse(repo_version) == parse(inst_version) and int(repo_build) > int(inst_build): return True except InvalidVersion as err: - repo_package: str = self.data[inst_name]['package'] if repo_version > inst_version: # Try to compare the strings. return True if repo_version == inst_version and int(repo_build) > int(inst_build): return True - if installed != repo_package: - return True self._write_log_file(installed, inst_name, err) return False @@ -142,9 +139,9 @@ class Upgrade(Configs): # pylint: disable=[R0902] """ if self.log_path.is_dir(): with self.upgrade_log_file.open('a', encoding='utf-8') as log: - log.write(f"Installed: {installed}, " - f"Repository: {self.data[name]['package']}, " - f"Error: {err}, " + log.write(f"{self.cyan}Installed{self.endc}: {installed}, " + f"{self.yellow}Repository{self.endc}: {self.data[name]['package']}, " + f"{self.red}Error{self.endc}: {err}, " f"Repo: {self.repository}\n") def check_packages(self) -> None: