-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwareflow-ems.spec
More file actions
100 lines (87 loc) · 2.47 KB
/
wareflow-ems.spec
File metadata and controls
100 lines (87 loc) · 2.47 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
"""
PyInstaller spec file for Wareflow EMS
This configuration builds a Windows executable (.exe) from the Python application.
It packages all dependencies, data files, and resources into a single file.
"""
import os
import sys
from pathlib import Path
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
# Get project root directory
# __file__ is not available in spec context, use sys.argv[0]
spec_file_path = Path(sys.argv[0]).resolve() if len(sys.argv) > 0 else Path.cwd()
project_root = spec_file_path.parent
# Bundle all external data files
datas = [
('images/icon.ico', '.'), # Application icon
('src', 'src'), # Include entire src directory
]
# Collect all data files from packages
datas += collect_data_files('customtkinter')
datas += collect_data_files('peewee')
# Collect all submodules to ensure complete imports
hiddenimports = [
'customtkinter',
'customtkinter.windows',
'peewee',
'PIL',
'PIL._tkinter_finder',
'openpyxl',
'openpyxl.cell._writer',
'tkinter',
'tkinter.ttk',
'sqlite3',
# 'magic', # Removed: causes PyInstaller crash
]
# Collect submodules
hiddenimports += collect_submodules('customtkinter')
hiddenimports += collect_submodules('peewee')
# Exclude unnecessary modules
excludes = [
'tests',
'pytest',
'pytest_asyncio',
'unittest',
'distutils',
]
block_cipher = None
a = Analysis(
['src/main_exe.py'], # Entry point for PyInstaller
pathex=[str(project_root)], # Add project root to path so PyInstaller can find src package
binaries=[],
datas=datas,
hiddenimports=hiddenimports,
hookspath=[],
hooksconfig={},
runtime_hooks=['src/pyi_rthook_src.py'], # Runtime hook to fix src imports
excludes=excludes,
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
# Remove tests from the build
a.datas = [x for x in a.datas if 'tests' not in x[0].lower()]
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='wems',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, # GUI application, no console window
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon='images/icon.ico', # Application icon
)