Version
This commit is contained in:
parent
3f4713ffbf
commit
0d7c2f8417
9 changed files with 59 additions and 34 deletions
|
|
@ -15,13 +15,14 @@ from version import VERSION
|
|||
|
||||
import subprocess
|
||||
|
||||
VERSION = "0.1.1"
|
||||
#VERSION = "0.1.1"
|
||||
|
||||
APP_NAME = "Simbriefimport"
|
||||
COMPANY = "Carsten"
|
||||
COPYRIGHT = "© 2025 Carsten"
|
||||
|
||||
VERSION_INFO_FILE = Path("version_info.txt")
|
||||
VERSION_RUNTIME_FILE = Path("version_runtime.txt")
|
||||
|
||||
|
||||
|
||||
|
|
@ -34,18 +35,36 @@ def _git_build_number() -> int:
|
|||
return int(out.decode().strip())
|
||||
except Exception:
|
||||
return 0
|
||||
def get_runtime_version() -> str:
|
||||
p = resource_path("version_runtime.txt")
|
||||
try:
|
||||
return p.read_text(encoding="utf-8").strip()
|
||||
except Exception:
|
||||
return "0.0.0.0"
|
||||
|
||||
|
||||
|
||||
def ensure_version_info(force: bool = False) -> str:
|
||||
"""
|
||||
Erzeugt version_info.txt für PyInstaller.
|
||||
Gibt die Textversion zurück, z.B. '1.4.0.237'.
|
||||
Erzeugt version_info.txt für PyInstaller und version_runtime.txt für die
|
||||
Laufzeit-Ausgabe in der EXE.
|
||||
Gibt die Textversion zurück, z.B. '0.1.1.59'.
|
||||
"""
|
||||
build = _git_build_number()
|
||||
major, minor, patch = map(int, VERSION.split("."))
|
||||
filevers = f"{major},{minor},{patch},{build}"
|
||||
textvers = f"{VERSION}.{build}"
|
||||
|
||||
# robust: erlaubt "1.4" -> 1.4.0
|
||||
parts = [int(p) for p in VERSION.split(".")]
|
||||
while len(parts) < 3:
|
||||
parts.append(0)
|
||||
major, minor, patch = parts[:3]
|
||||
|
||||
filevers = f"{major},{minor},{patch},{build}"
|
||||
textvers = f"{major}.{minor}.{patch}.{build}"
|
||||
|
||||
# Runtime-Version IMMER schreiben, damit Log und EXE konsistent sind
|
||||
VERSION_RUNTIME_FILE.write_text(textvers, encoding="utf-8")
|
||||
|
||||
# Version-Info nur schreiben, wenn force oder Datei fehlt
|
||||
if VERSION_INFO_FILE.exists() and not force:
|
||||
return textvers
|
||||
|
||||
|
|
@ -82,10 +101,6 @@ def ensure_version_info(force: bool = False) -> str:
|
|||
)
|
||||
"""
|
||||
VERSION_INFO_FILE.write_text(content, encoding="utf-8")
|
||||
VERSION_RUNTIME_FILE = Path("version_runtime.txt")
|
||||
|
||||
# ...
|
||||
VERSION_RUNTIME_FILE.write_text(textvers, encoding="utf-8")
|
||||
return textvers
|
||||
def get_build():
|
||||
try:
|
||||
|
|
@ -482,6 +497,11 @@ client = OpenAI(
|
|||
|
||||
# dict
|
||||
|
||||
if "--make-version" in sys.argv:
|
||||
ver = ensure_version_info(force=True) # <-- MUSS True sein
|
||||
print(ver)
|
||||
raise SystemExit(0)
|
||||
|
||||
Stimmung = str(stimmung())
|
||||
|
||||
|
||||
|
|
@ -622,7 +642,7 @@ logging.info("--------------------------------------------------")
|
|||
logging.info(" F E R T S C H ")
|
||||
logging.info("--------------------------------------------------")
|
||||
|
||||
logging.info("Version: %s.%s", VERSION, get_build())
|
||||
logging.info("Version: %s", get_runtime_version())
|
||||
#VERSION = str("Version: %s.%s", VERSION, get_build())
|
||||
ver = ensure_version_info() # erzeugt version_info.txt im Dev-Workspace
|
||||
logging.info("Programmversion: %s", ver)
|
||||
logging.info("Programmversion: %s", get_runtime_version())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue