when importing complib a version check is now performed and the user is notified if he is using an outdated version

This commit is contained in:
Joel 2021-02-06 23:51:24 +01:00
parent 90e3dd6f00
commit ce6b06544a
No known key found for this signature in database
GPG key ID: BDDDBECD0808290E
4 changed files with 20 additions and 4 deletions

View file

@ -1,6 +1,16 @@
__version__ = "0.0.4-17"
__version__ = "0.0.4-19"
import compLib.LogstashLogging
import logging
import apt
print(f"Starting compLib! Version: {__version__} ...")
try:
__versions = apt.Cache()["python3-complib"].versions
if len(__versions) != 1:
print(f"Starting compLib! \033[91mVersion: {__version__} is outdated\033[0m\n"
f"\033[92m[!] run the command 'apt update && apt install python3-complib' to install the newest version\033[0m")
else:
print(f"Starting compLib! \033[92mVersion: {__version__} is up to date\033[0m")
except Exception as e:
compLib.LogstashLogging.Logging.get_logger().error(f"error during checking apt package version -> {str(e)}")
print(f"\033[91merror during checking apt package version -> {str(e)}\033[0m\n")