BonPrinter v1.2.0
Thermal Printer tool
Loading...
Searching...
No Matches
version.py
Go to the documentation of this file.
1"""!
2********************************************************************************
3@file version.py
4@brief Version and general information
5********************************************************************************
6"""
7
8import sys
9from typing import Optional
10
11# Version
12VERSION_MAJOR = 1 # major changes/breaks at API (e.g incompatibility)
13VERSION_MINOR = 2 # minor changes/does not break the API (e.g new feature)
14VERSION_PATCH = 0 # Bug fixes
15VERSION_BUILD = 0 # build number (if available)
16
17__title__ = "BonPrinter"
18__description__ = "Thermal Printer tool"
19__author__ = "Timo Unger"
20__owner__ = "timounger"
21__repo__ = "BonPrinterHome"
22__copyright__ = f"Copyright © 2022-2025 {__author__}"
23__license__ = "GNU General Public License"
24__home__ = f"https://{__owner__}.github.io/{__repo__}"
25
26if VERSION_BUILD == 0:
27 PRERELEASE_BUILD = False
28 __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_PATCH}"
29else:
30 PRERELEASE_BUILD = True # Mark the FW as a pre-release build and protect it from unauthorized use.
31 __version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_PATCH}.{VERSION_BUILD}"
32
33# debug/test code
34
35
36def running_as_exe() -> bool:
37 """!
38 @brief Check if we are currently running as an executable or directly in Python
39 @return [True|False] running as an EXE
40 """
41 # PyInstaller creates a temp folder and stores path in _MEIPASS
42 return bool(hasattr(sys, "_MEIPASS"))
43
44
45GIT_SHORT_SHA: Optional[str] = None
46
48 try:
49 from Source.Util.git_version import GIT_SHORT_SHA # type: ignore # pylint: disable=unused-import
50 except ImportError:
51 GIT_SHORT_SHA = None
bool running_as_exe()
Check if we are currently running as an executable or directly in Python.
Definition version.py:36