forked from LagoLunatic/wwrando
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.py
44 lines (34 loc) · 1.5 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
36
37
38
39
40
41
42
43
44
import os
import platform
import shutil
from randomizer import VERSION_WITHOUT_COMMIT
base_name = "Wind Waker Randomizer"
import struct
if (struct.calcsize("P") * 8) == 64:
bitness_suffix = "_64bit"
else:
bitness_suffix = "_32bit"
exe_ext = ""
if platform.system() == "Windows":
exe_ext = ".exe"
platform_name = "win"
if platform.system() == "Darwin":
exe_ext = ".app"
platform_name = "mac"
if platform.system() == "Linux":
platform_name = "linux"
exe_path = os.path.join(".", "dist", base_name + exe_ext)
if not (os.path.isfile(exe_path) or os.path.isdir(exe_path)):
raise Exception("Executable not found: %s" % exe_path)
release_archive_path = os.path.join(".", "dist", "release_archive_" + VERSION_WITHOUT_COMMIT + bitness_suffix)
if os.path.exists(release_archive_path) and os.path.isdir(release_archive_path):
shutil.rmtree(release_archive_path)
os.mkdir(release_archive_path)
shutil.copyfile("README.md", os.path.join(release_archive_path, "README.txt"))
if platform.system() == "Darwin":
shutil.move(exe_path, os.path.join(release_archive_path, base_name + exe_ext))
shutil.copyfile(os.path.join(".", "models", "About Custom Models.txt"), os.path.join(release_archive_path, "About Custom Models.txt"))
else:
os.mkdir(os.path.join(release_archive_path, "models"))
shutil.move(exe_path, os.path.join(release_archive_path, base_name + exe_ext))
shutil.copyfile(os.path.join(".", "models", "About Custom Models.txt"), os.path.join(release_archive_path, "models", "About Custom Models.txt"))