From 98d9a84031892f595824e36db0b3ee934b7e73fe Mon Sep 17 00:00:00 2001 From: hubobel Date: Sun, 28 Dec 2025 17:06:04 +0100 Subject: [PATCH] Version eingebaut --- Simbriefimport.py | 19 +++++++++++++++---- version.py | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 version.py diff --git a/Simbriefimport.py b/Simbriefimport.py index 76ff40d..dc63300 100644 --- a/Simbriefimport.py +++ b/Simbriefimport.py @@ -1,4 +1,4 @@ -#V0.1.1b @MAC +#V0.1.1b @PC import requests import json from pathlib import Path @@ -10,8 +10,17 @@ import random import shutil import logging from logging.handlers import RotatingFileHandler +from version import VERSION - +def get_build(): + try: + import subprocess + return subprocess.check_output( + ["git", "rev-list", "--count", "HEAD"], + stderr=subprocess.DEVNULL + ).decode().strip() + except Exception: + return "0" def setup_logging(app_dir, level=logging.INFO, console=True): logging.getLogger("httpx").setLevel(logging.WARNING) log_file = app_dir / "Simbriefimport.log" @@ -467,7 +476,7 @@ ordnerneu.mkdir(exist_ok=True) logging.info("--------------------------------------------------") logging.info("START .txt Erzeugung ") logging.info("--------------------------------------------------") -debug = False +debug = True if debug == False: metarCabin = METAR() metar = metarCabin.choices[0].message.content @@ -533,4 +542,6 @@ if debug == False: logging.info("--------------------------------------------------") logging.info(" F E R T S C H ") -logging.info("--------------------------------------------------") \ No newline at end of file +logging.info("--------------------------------------------------") + +logging.info("Version: %s.%s", VERSION, get_build()) diff --git a/version.py b/version.py new file mode 100644 index 0000000..5cc607b --- /dev/null +++ b/version.py @@ -0,0 +1 @@ +VERSION = "0.1.1b"