Git hash is now also in.

This commit is contained in:
2023-04-26 15:52:09 +02:00
parent a5d767baeb
commit 14f7f5c6ac

View File

@@ -24,6 +24,9 @@
# DO NOT REMOVE THIS PREAMBLE !!! # DO NOT REMOVE THIS PREAMBLE !!!
# #
import time
import pathlib
# #
# #
@@ -47,20 +50,25 @@ globvar_configfile_path = "./AFM_thumbs/"
# #
# #
# _____________________________________________________________________ to here # _____________________________________________________________________ to here
#
#
#
# ____________________________________________________________ Git hash version
# Get the git hash version
def get_git_revision(base_path):
git_dir = pathlib.Path(base_path) / '.git'
with (git_dir / 'HEAD').open('r') as head:
ref = head.readline().split(' ')[-1].strip()
with (git_dir / ref).open('r') as git_hash:
return git_hash.readline().strip()
# ____________________________________________________________ Global variables # ____________________________________________________________ Global variables
# DO NOT CHANGE ANYTHING BELOW, OTHERWISE YOU KNOW WHAT TO DO ! # DO NOT CHANGE ANYTHING BELOW, OTHERWISE YOU KNOW WHAT TO DO !
import time
globvar_contributions = "Reinhard Olbrich (testing)\n" \ globvar_contributions = "Reinhard Olbrich (testing)\n" \
"Matthias Temmen (testing)\n" \ "Matthias Temmen (testing)\n" \
"Alexander v Schmidtsfeld (testing)\n" \ "Alexander v Schmidtsfeld (testing)\n" \
@@ -68,6 +76,7 @@ globvar_contributions = "Reinhard Olbrich (testing)\n" \
globvar_year = "2023-04-26" globvar_year = "2023-04-26"
globvar_version = "3.0.1111" globvar_version = "3.0.1111"
globvar_git_version = get_git_revision(os.path.join(os.path.dirname(__file__), "../"))
globvar_spaces = " " globvar_spaces = " "
globvar_name = "AFM thumbs v" + globvar_version globvar_name = "AFM thumbs v" + globvar_version
@@ -85,14 +94,15 @@ globvar_note = ("Version " + globvar_version + " (" +
"Contributions from:\n" + "Contributions from:\n" +
globvar_contributions) globvar_contributions)
globvar_console = ("\n\n"+ globvar_console = ("\n\n" +
globvar_spaces + globvar_spaces +
globvar_name + " - " + globvar_name + " - " +
globvar_year + "\n" + globvar_year + "\n" +
globvar_spaces + "www.root-1.de\n\n" + "GIT commit: " + globvar_git_version + "\n" +
globvar_spaces + "Today: " + globvar_spaces + "www.root-1.de\n\n" +
time.strftime("%d-%m-%Y") + globvar_spaces + "Today: " +
", Time: " + time.strftime("%d-%m-%Y") +
", Time: " +
time.strftime("%H:%M:%S")) time.strftime("%H:%M:%S"))
globvar_python_directory = "AFM_thumbs" globvar_python_directory = "AFM_thumbs"