-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_bo_archive.py
executable file
·35 lines (28 loc) · 1.06 KB
/
make_bo_archive.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
28
29
30
31
32
33
34
35
import sys
import os
from datetime import datetime
from subprocess import check_output
from zipfile import ZipFile, ZIP_DEFLATED
os.chdir(os.path.normpath(os.path.join(os.path.dirname(sys.argv[0]), "FreeOrion")))
build_no = "XXXX"
try:
commit = str(check_output(["git", "show", "-s", "--format=%h", "--abbrev=7", "HEAD"]).decode()).strip()
timestamp = float(check_output(["git", "show", "-s", "--format=%ct", "HEAD"]).strip())
build_no = ".".join([datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d"), commit])
except:
print("WARNING: git not installed, can't determine build number")
out_dir = os.path.dirname(sys.argv[0])
out_file = "FreeOrion_%s_Test_Win32_BinariesOnly.zip" % build_no
out_path = os.path.join(out_dir, out_file)
if os.path.exists(out_file):
os.remove(out_file)
in_files = [
"FreeOrion.exe",
"FreeOrionCA.exe",
"FreeOrionD.exe",
"GiGi.dll"
]
print("Creating %s in %s" % (out_file, out_dir))
with ZipFile(out_path, "w", ZIP_DEFLATED) as ar:
for f in in_files:
ar.write(f)