-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblackjack_game.spec
More file actions
196 lines (177 loc) · 4.6 KB
/
blackjack_game.spec
File metadata and controls
196 lines (177 loc) · 4.6 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# -*- mode: python ; coding: utf-8 -*-
import os
import sys
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
# Get the current directory (where the spec file is located)
current_dir = os.path.dirname(os.path.abspath(SPEC))
print(f"Current directory: {current_dir}")
# Collect all textual data files
try:
textual_datas = collect_data_files('textual')
print(f"Found {len(textual_datas)} textual data files")
except Exception as e:
print(f"Error collecting textual data: {e}")
textual_datas = []
# Define data files to include
datas = []
# Add files with existence checks
data_files = [
('tcss', 'tcss'),
('WezTerm', 'WezTerm'),
('blackjackModule.py', '.'),
('blackjack.py', '.'),
('requirements.txt', '.'),
('LICENSE.md', '.'),
('README.md', '.'),
]
for src, dst in data_files:
src_path = os.path.join(current_dir, src)
if os.path.exists(src_path):
datas.append((src_path, dst))
print(f"Added to bundle: {src_path} -> {dst}")
else:
print(f"Warning: File not found: {src_path}")
# Add textual data files
if textual_datas:
datas.extend(textual_datas)
print(f"Added {len(textual_datas)} textual data files")
# Comprehensive hidden imports for standalone execution
hiddenimports = [
# Core textual
'textual',
'textual.app',
'textual.widgets',
'textual.containers',
'textual.screen',
'textual.reactive',
'textual.binding',
'textual.css',
'textual.driver',
'textual._loop',
'textual.geometry',
'textual.color',
'textual.design',
'textual.strip',
'textual.suggestion',
'textual.filter',
'textual.dom',
'textual.css.query',
'textual.css.parse',
'textual.css.styles',
'textual.css.tokenize',
'textual.css.tokenizer',
# Rich dependencies
'rich',
'rich.console',
'rich.text',
'rich.table',
'rich.panel',
'rich.align',
'rich.layout',
'rich.segment',
'rich.style',
'rich.color',
'rich.markup',
'rich.highlighter',
'rich.protocol',
'rich.measure',
'rich.cells',
'rich.region',
'rich.repr',
'rich._loop',
'rich._wrap',
'rich._extension',
# System modules
'typing_extensions',
'importlib_metadata',
'platform',
'subprocess',
'os',
'sys',
'pathlib',
'asyncio',
'threading',
'time',
'random',
'json',
'functools',
'itertools',
# Game modules
'blackjackModule',
]
# Collect all textual and rich submodules
try:
hiddenimports.extend(collect_submodules('textual'))
hiddenimports.extend(collect_submodules('rich'))
print(f"Collected submodules. Total hidden imports: {len(hiddenimports)}")
except Exception as e:
print(f"Error collecting submodules: {e}")
# Define binaries with existence checks
binaries = []
binary_files = [
('WezTerm/wezterm.exe', 'WezTerm'),
('WezTerm/wezterm-gui.exe', 'WezTerm'),
('WezTerm/wezterm-mux-server.exe', 'WezTerm'),
('WezTerm/conpty.dll', 'WezTerm'),
('WezTerm/libEGL.dll', 'WezTerm'),
('WezTerm/libGLESv2.dll', 'WezTerm'),
('WezTerm/OpenConsole.exe', 'WezTerm'),
('WezTerm/strip-ansi-escapes.exe', 'WezTerm'),
('WezTerm/wezterm.pdb', 'WezTerm'),
('WezTerm/mesa/opengl32.dll', 'WezTerm/mesa'),
]
for src, dst in binary_files:
src_path = os.path.join(current_dir, src)
if os.path.exists(src_path):
binaries.append((src_path, dst))
print(f"Added binary: {src_path} -> {dst}")
else:
print(f"Warning: Binary not found: {src_path}")
print(f"\nFinal summary:")
print(f"Data files: {len(datas)}")
print(f"Binaries: {len(binaries)}")
print(f"Hidden imports: {len(hiddenimports)}")
a = Analysis(
['main.py'],
pathex=[current_dir],
binaries=binaries,
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='BlackjackGame',
debug=True, # Enable debug mode for better error messages
bootloader_ignore_signals=False,
strip=False,
upx=False,
console=True, # Keep console for debug output
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=None,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=False,
upx_exclude=[],
name='BlackjackGame',
)