-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
57 lines (45 loc) · 1.44 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
45
46
47
48
49
50
51
52
53
54
55
56
57
# MOP Builder
# This script let's you quickly compress new release to .zip file.
# Script version: 1.0.0 (14.12.2019)
#
# This file is distributed under the same license as the MOP is.
import os
import sys
import zipfile
from zipfile import ZipFile
from array import array
import shutil
import math
print("=== Building the release... ===\n")
BASE_DIR = os.getcwd()
def make_zip(files, zipName):
print('Creating new zip: {0}'.format(zipName))
NEW_ZIP = ZipFile(BASE_DIR + "\\" + zipName, 'w', zipfile.ZIP_DEFLATED)
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
x = 1
for file in files:
NEW_ZIP.write(file)
a = x / len(files) * 100
print("Progress: " + str(int(math.ceil(a))) + "% (" + file + ")")
sys.stdout.write(CURSOR_UP_ONE)
sys.stdout.write(ERASE_LINE)
x += 1
NEW_ZIP.close()
os.chdir(BASE_DIR)
shutil.rmtree(BASE_DIR + "\\build", True)
os.mkdir("build")
shutil.copyfile("ActualMop\\bin\\Release\\ActualMop.dll",
"build\\ActualMop.dll")
shutil.copyfile("PleaseReadMe.txt", "build\\PleaseReadMe.txt")
os.makedirs("build\\Assets\\ActualMop")
shutil.copyfile("MopAsset\\AssetBundles\\mop.unity3d",
"build\\Assets\\ActualMop\\mop.unity3d")
os.chdir("build")
FILES = []
FILES.extend(["ActualMop.dll"])
FILES.extend(["PleaseReadme.txt"])
FILES.extend(["Assets\\ActualMop\\mop.unity3d"])
make_zip(FILES, "ActualMop.zip")
print("Done!\nQuitting...")
quit()