Index: leahi_dialin/version.py =================================================================== diff -u -rf8c8af8419655d29685451540605d90509c461fa -r230095218088ec691b15c63393c7bc1d51ed9ab3 --- leahi_dialin/version.py (.../version.py) (revision f8c8af8419655d29685451540605d90509c461fa) +++ leahi_dialin/version.py (.../version.py) (revision 230095218088ec691b15c63393c7bc1d51ed9ab3) @@ -7,17 +7,20 @@ # # @file version.py # -# @author (last) Jonny Paguio -# @date (last) 14-Aug-2025 +# @author (last) Zoltan Miskolci +# @date (last) 22-Jun-2026 # @author (original) Peter Lucia # @date (original) 22-Jun-2021 # ############################################################################ + +# Module imports import subprocess import os.path +from typing import Tuple -VERSION = "1.0.0" +VERSION_FILE_LOCATION = f'{os.path.realpath(__file__)}/../../VERSION' def get_branch(): """ @@ -68,17 +71,30 @@ return res -branch = None -commit = None +def read_version_file() -> Tuple[str, str, str, str]: + """ + Loads the information from the VERSION file. -DEV_VERSION = VERSION + @return: Version information + """ + version = None + build_num = None + branch = None + commit = None -if check_if_git_repo(): - branch = get_branch() - commit = get_last_commit() - DEV_VERSION += ".{0}".format(branch) - DEV_VERSION += ".{0}".format(commit) + with open(file = os.path.abspath(VERSION_FILE_LOCATION)) as f: + content = f.read().split('-') + version = content[0] + build_num = content[1] + branch = content[2] + if branch == 'local' and check_if_git_repo(): + branch = get_branch() + commit = get_last_commit() + return f'{version}.{build_num}.{branch}.{commit}' + +DEV_VERSION = read_version_file() + if __name__ == '__main__': - print(VERSION) \ No newline at end of file + print(DEV_VERSION) \ No newline at end of file