Added colors to log file

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2024-05-31 17:09:16 +03:00
parent a57589afe2
commit 83e1a48180

View file

@ -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: