-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoce.spec
165 lines (136 loc) · 3.95 KB
/
oce.spec
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# -*- mode: python -*-
import os
from glob import glob
print("#################################")
print("# Building OsuCollectionsEditor #")
print("#################################")
block_cipher = None
# Add staticfiles to build
static_files = [
('logging.conf', '.'),
('icons', 'icons')
]
# Build the exe with libraries
print("")
print("Building OCE with separate libraries")
print("####################################")
print("")
print("Analysing...")
print("")
a = Analysis(['oce.py'],
pathex=[SPECPATH],
binaries=static_files,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
print("")
print("Archiving")
print("")
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
print("")
print("Compiling executable")
print("")
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='oce',
debug=False,
strip=False,
upx=True,
console=False,
icon='icons\oce.ico' )
print("")
print("Collecting libraries")
print("")
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='oce')
# Build the portable exe
print("")
print("Building OCE portable (with included libraries)")
print("###############################################")
print("")
print("Analysing")
print("")
a = Analysis(['oce.py'],
pathex=[SPECPATH],
binaries=static_files,
datas=static_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
print("")
print("Archiving")
print("")
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
print("")
print("Building executable")
print("")
portable_exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='oce_p',
debug=False,
strip=False,
upx=True,
console=False,
icon='icons\oce.ico' )
print("")
print("Collecting static files")
print("")
# Copy static files to portable dir
a.datas += [('logging.conf', 'logging.conf', 'DATA')]
for i in glob(os.path.join('icons', '*')):
a.datas += [(i, i, 'DATA')]
portable_coll = COLLECT(portable_exe,
a.datas,
strip=False,
upx=True,
name="oce_portable"
)
print("")
print("Cleaning up")
print("")
# Remove portable executable on linux
if os.path.isfile(os.path.join(DISTPATH, "oce_p")):
try:
os.remove(os.path.join(DISTPATH, "oce_p"))
except OSError:
pass
# Remove portable executable on windows
if os.path.isfile(os.path.join(DISTPATH, "oce_p.exe")):
try:
os.remove(os.path.join(DISTPATH, "oce_p.exe"))
except OSError:
pass
# Rename the exe in the portable dir on Linux
if os.path.isfile(os.path.join(DISTPATH, "oce_portable", "oce_p")):
try:
os.rename(os.path.join(DISTPATH, "oce_portable", "oce_p"), os.path.join(DISTPATH, "oce_portable", "oce"))
except WindowsError:
os.remove(os.path.join(DISTPATH, "oce_portable", "oce"))
os.rename(os.path.join(DISTPATH, "oce_portable", "oce_p"), os.path.join(DISTPATH, "oce_portable", "oce"))
# Rename the exe in the portable dir on Windows
if os.path.isfile(os.path.join(DISTPATH, "oce_portable", "oce_p.exe")):
try:
os.rename(os.path.join(DISTPATH, "oce_portable", "oce_p.exe"), os.path.join(DISTPATH, "oce_portable", "oce.exe"))
except WindowsError:
os.remove(os.path.join(DISTPATH, "oce_portable", "oce.exe"))
os.rename(os.path.join(DISTPATH, "oce_portable", "oce_p.exe"), os.path.join(DISTPATH, "oce_portable", "oce.exe"))