summaryrefslogtreecommitdiffstats
path: root/methods.py
diff options
context:
space:
mode:
authorPoommetee Ketson <poommetee@protonmail.com>2017-07-10 15:47:38 +0700
committerPoommetee Ketson <poommetee@protonmail.com>2017-07-11 15:57:52 +0700
commit5a9eb5ef58288506256998bcbc9c1fc20d4f50d1 (patch)
treef3897bdeced775dd9df467fd1b210374a7a8524b /methods.py
parent159b1fc65f650df0428dbfa9d14e3fd0bcfb94d0 (diff)
downloadredot-engine-5a9eb5ef58288506256998bcbc9c1fc20d4f50d1.tar.gz
Include Git hash in the engine
Diffstat (limited to 'methods.py')
-rw-r--r--methods.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/methods.py b/methods.py
index 4d3d5ae343..abd87c07d7 100644
--- a/methods.py
+++ b/methods.py
@@ -1176,6 +1176,20 @@ def update_version():
f.write("#define VERSION_STATUS " + str(version.status) + "\n")
import datetime
f.write("#define VERSION_YEAR " + str(datetime.datetime.now().year) + "\n")
+ f.close()
+
+ fhash = open("core/version_hash.gen.h", "wb")
+ githash = ""
+ if os.path.isfile(".git/HEAD"):
+ head = open(".git/HEAD", "rb").readline().strip()
+ if head.startswith("ref: "):
+ head = ".git/" + head[5:]
+ if os.path.isfile(head):
+ githash = open(head, "rb").readline().strip()
+ else:
+ githash = head
+ fhash.write("#define VERSION_HASH \"" + githash + "\"")
+ fhash.close()
def parse_cg_file(fname, uniforms, sizes, conditionals):