forked from bugdone/headshotbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
35 lines (29 loc) · 1.21 KB
/
build.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
# environment paths demoinfogo_bin_linux and demoinfogo_bin_win
# should point to directories where the demoinfogo binaries are
import os
import os.path
import shutil
os.system('lein clean')
os.system('LEIN_SNAPSHOTS_IN_RELEASE=1 lein uberjar')
jar = [f for f in os.listdir('./target') if f.endswith('-standalone.jar')][0]
version = jar.split('-')[1]
for os_name in ['linux', 'win']:
dir_name = 'headshotbox-%s-%s' % (version, os_name)
path = dir_name + '/' + dir_name
demoinfogo = os.environ['demoinfogo_bin_' + os_name]
if os.path.exists(dir_name):
shutil.rmtree(dir_name)
os.mkdir(dir_name)
shutil.copytree(demoinfogo, path)
shutil.copy('target/' + jar, path)
def write_launcher(filename, content):
with open(path + '/' + filename, 'w') as f:
f.write(content % jar)
if os_name == 'win':
write_launcher('headshotbox.bat', 'start javaw -jar %s --port 4000 --systray')
write_launcher('headshotbox_console.bat', 'java -jar %s --port 4000')
else:
write_launcher('headshotbox.sh', 'java -jar %s --port 4000')
if os_name == 'linux':
os.system('chmod +x %s/headshotbox.sh' % path)
shutil.make_archive(dir_name, 'zip', dir_name)