-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectBundle.spec
More file actions
150 lines (140 loc) · 3.22 KB
/
ProjectBundle.spec
File metadata and controls
150 lines (140 loc) · 3.22 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
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
# -*- mode: python ; coding: utf-8 -*-
import os
block_cipher = None
# In spec context, __file__ may not be defined. Use current working directory.
proj_root = os.path.abspath('.')
# Data files to include in the bundle
_datas = [
(os.path.join(proj_root, 'server_config.json'), '.'),
(os.path.join(proj_root, 'config.json'), '.'),
]
# Helper to include whole folders
from PyInstaller.building.datastruct import Tree
# Common analysis options
_pathex = [proj_root]
_hiddenimports = [
'PIL',
'PIL.Image',
'PIL.ImageFile',
'PIL.PngImagePlugin',
'PIL.JpegImagePlugin',
'PIL.features',
] # Ensure Pillow JPEG/PNG plugins and features are bundled
# GUI EXE (bot_gui.py)
a1 = Analysis(
['bot_gui.py'],
pathex=_pathex,
binaries=[],
datas=_datas,
hiddenimports=_hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz1 = PYZ(a1.pure, a1.zipped_data, cipher=block_cipher)
exe1 = EXE(
pyz1,
a1.scripts,
a1.binaries,
a1.zipfiles,
a1.datas,
[],
name='ImageDetectionBot',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
icon=None,
)
# Console EXE (web_server.py)
a2 = Analysis(
['web_server.py'],
pathex=_pathex,
binaries=[],
datas=_datas,
hiddenimports=_hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz2 = PYZ(a2.pure, a2.zipped_data, cipher=block_cipher)
exe2 = EXE(
pyz2,
a2.scripts,
a2.binaries,
a2.zipfiles,
a2.datas,
[],
name='WebServer',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
icon=None,
)
# GUI EXE (launcher.py)
a3 = Analysis(
['launcher.py'],
pathex=_pathex,
binaries=[],
datas=_datas,
hiddenimports=_hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz3 = PYZ(a3.pure, a3.zipped_data, cipher=block_cipher)
exe3 = EXE(
pyz3,
a3.scripts,
a3.binaries,
a3.zipfiles,
a3.datas,
[],
name='Launcher',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
icon=None,
)
collect = COLLECT(
exe1,
exe2,
exe3,
a1.binaries + a2.binaries + a3.binaries,
a1.zipfiles + a2.zipfiles + a3.zipfiles,
a1.datas + a2.datas + a3.datas,
# Include asset directories as Trees at COLLECT stage (expects TOC-like objects here)
Tree(os.path.join(proj_root, 'web', 'static'), prefix='web/static'),
Tree(os.path.join(proj_root, 'images'), prefix='images'),
Tree(os.path.join(proj_root, 'failsafe_images'), prefix='failsafe_images'),
strip=False,
upx=True,
upx_exclude=[],
name='ProjectBundle'
)