-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathSGAv3.spec
More file actions
109 lines (106 loc) · 2.77 KB
/
Copy pathSGAv3.spec
File metadata and controls
109 lines (106 loc) · 2.77 KB
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
# -*- mode: python ; coding: utf-8 -*-
from os import path
# pyinstaller SGAv3.spec
a = Analysis(
['SGAv3.py'],
pathex=[],
binaries=[],
datas=[
("venv\Lib\site-packages\win32comext\shell\shellcon.py", "win32com\shell"),
("maincode\script", "maincode\script"),
],
hiddenimports=["playsound3"],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
b = Analysis(
['SGAv3.py'],
pathex=[],
binaries=[],
datas=[
("venv\Lib\site-packages\win32comext\shell\shellcon.py", "win32com\shell"),
("maincode\script", "maincode\script"),
],
hiddenimports=["playsound3"],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
private_module = []
tempa = a.pure.copy(); a.pure.clear()
for name, src, type in tempa:
condition = [name.startswith(m) for m in private_module]
if condition and any(condition):
a.pure.append((name, src, type)) # 把需要保留打包的 py 文件重新添加回 a.pure
else:
name = name.replace('.', os.sep)
init = path.join(name, '__init__.py')
pos = src.find(init) if init in src else src.find(name)
dst = src[pos:]
# dst = path.join('libs', dst)
a.datas.append((dst, src, 'DATA'))
pyza = PYZ(a.pure)
tempb = b.pure.copy(); b.pure.clear()
for name, src, type in tempb:
condition = [name.startswith(m) for m in private_module]
if condition and any(condition):
b.pure.append((name, src, type)) # 把需要保留打包的 py 文件重新添加回 a.pure
else:
name = name.replace('.', os.sep)
init = path.join(name, '__init__.py')
pos = src.find(init) if init in src else src.find(name)
dst = src[pos:]
# dst = path.join('libs', dst)
b.datas.append((dst, src, 'DATA'))
pyzb = PYZ(b.pure)
exea = EXE(
pyza,
a.scripts,
[],
exclude_binaries=True,
name='SGA',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=["resources/main/SGA/icon.ico"],
)
exeb = EXE(
pyzb,
b.scripts,
[],
exclude_binaries=True,
name='SGA-c',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=["resources/main/SGA/icon.ico"],
)
coll = COLLECT(
exea,
exeb,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='SGAv3',
)