-
Notifications
You must be signed in to change notification settings - Fork 24
/
KH2 Randomizer.spec
151 lines (128 loc) · 3.41 KB
/
KH2 Randomizer.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
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
import os, glob, shutil, importlib, khbr
for root, dirs, files in os.walk(DISTPATH):
for f in files:
os.unlink(os.path.join(root, f))
for d in dirs:
shutil.rmtree(os.path.join(root, d))
khbrpath = os.path.dirname(khbr.__file__)
def build_datas_recursive(paths):
datas = []
for path in paths:
for filename in glob.iglob(path, recursive=True):
if os.path.isfile(filename):
dest_dirname = os.path.dirname(filename)
if dest_dirname == "":
dest_dirname = "."
data_entry = (filename, dest_dirname)
datas.append(data_entry)
print(data_entry)
return datas
def external_data_recursive(paths):
datas = []
for path in paths:
for filename in glob.iglob(path, recursive=True):
if os.path.isfile(filename):
dest_dirname = os.path.dirname(filename)
if dest_dirname == "":
dest_dirname = "."
else:
dest_dirname = dest_dirname.split("site-packages\\")[1]
data_entry = (filename, dest_dirname)
datas.append(data_entry)
print(data_entry)
return datas
updater_analysis = Analysis(
['updater.py'],
pathex=[],
binaries=[],
datas=build_datas_recursive([
'UI/**/*.*',
'UI/*.*',
'Module/icon.png',
]),
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(updater_analysis.pure, updater_analysis.zipped_data, cipher=block_cipher)
updater_exe = EXE(
pyz,
updater_analysis.scripts,
updater_analysis.binaries,
updater_analysis.zipfiles,
updater_analysis.datas,
[],
name='updater',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='rando.ico'
)
a = Analysis(
['localUI.py'],
pathex=[],
binaries=[('{0}/updater.exe'.format(DISTPATH),".")],
datas=build_datas_recursive([
'UI/**/*.*',
'UI/*.*',
'static/**/*.*',
'static/*.*',
'presets/*.*',
'Module/icon.png',
'extracted_data.zip'
]) + external_data_recursive([khbrpath+"/**/*"]),
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
rando_pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
rando_pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='KH2 Randomizer',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='rando.ico'
)
#presetPath = '{0}/presets'.format(DISTPATH)
#if os.path.exists(presetPath):
# shutil.rmtree(presetPath)
#shutil.copytree('presets', presetPath)
#shutil.make_archive('Kingdom Hearts II Final Mix Randomizer', 'zip', DISTPATH)