Added logging

This commit is contained in:
Dimitris Zlatanidis 2023-04-05 21:22:12 +03:00
parent 5e0103a8e5
commit 33c6d676c2

View file

@ -1,6 +1,7 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
from typing import Generator
from packaging.version import parse, InvalidVersion
@ -23,6 +24,7 @@ class Upgrade(Configs):
self.repo_for_binaries: bool = self.utils.is_option(self.flag_bin_repository, self.flags)
self.all_installed: list = self.utils.installed_package_names
logging.basicConfig(filename='slpkg_upgrade.log', encoding='utf-8', level=logging.DEBUG)
def packages(self) -> Generator[str, None, None]:
""" Returns the upgradable packages. """
@ -64,7 +66,7 @@ class Upgrade(Configs):
if parse(repo_version) == parse(inst_version) and parse(repo_build) > parse(inst_build):
return True
except InvalidVersion:
pass
except InvalidVersion as err:
logging.debug(err)
return False