-
Notifications
You must be signed in to change notification settings - Fork 621
/
update_version.py
28 lines (22 loc) · 795 Bytes
/
update_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
script_dir = os.path.dirname(os.path.realpath(__file__))
os.chdir(script_dir)
if os.path.exists('.git') \
and os.path.exists(os.path.join("armoryengine", "ArmoryUtils.py")):
current_head = os.path.join(".git", "HEAD")
f = open(current_head, "r")
ref = f.read()
f.close()
path_parts = ref[5:-1].split("/")
hash_loc = os.path.join(".git", *path_parts)
f = open(hash_loc, "r")
build = f.read()[:10]
f.close()
build_file = os.path.join("armoryengine", "ArmoryBuild.py")
f = open(build_file, "w")
f.write("BTCARMORY_BUILD = '%s'\n" % build)
f.close()
print "Build number has been updated to %s" % build
else:
print "Please run this script from the root Armory source directory" \
" along with the .git directory"