-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulator.spec
More file actions
135 lines (120 loc) · 3.94 KB
/
simulator.spec
File metadata and controls
135 lines (120 loc) · 3.94 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
# -- mode: python ; coding: utf-8 --
# To build: pyinstaller simulator.spec
import os
import sys
import wandb
import osmnx
import hexaly
from glob import glob
# Define the path to the site-packages directory
wandb_path = os.path.dirname(wandb.__file__)
osmnx_path = os.path.dirname(osmnx.__file__)
hexaly_package_path = os.path.dirname(hexaly.__file__)
# Find the osmnx metadata directory
# This path is usually one level up from the osmnx package directory
try:
osmnx_metadata_dir = glob(os.path.join(os.path.dirname(osmnx_path), 'osmnx-*.dist-info'))[0]
except IndexError:
osmnx_metadata_dir = None
lib_source = os.path.join(hexaly_package_path, 'libhexaly140.so')
# Assuming the root of your project is where you want to start path searching
pathex=['.'] # Set pathex to the /app directory
a = Analysis(
['__main__.py'], # Explicitly list entry point
pathex=['.'], # Start path search from here
binaries=[
(lib_source, '.'),
],
datas=[
# Include data files
('data/wsr_simulator/*', 'data'),
('assets/model_weights/*', 'assets/model_weights'),
('assets/logs/*', 'assets/logs'),
# ---------------------------------------------------------
# NEW: Map the configs to the exact relative internal path
# ---------------------------------------------------------
('logic/configs', 'logic/configs'),
],
hiddenimports=[
# Other modules
'torch', 'numpy', 'argparse',
'multiprocessing', 'torch.multiprocessing',
'multiprocessing.pool', 'multiprocessing.manager',
# Ensure Hydra's dynamic internal configs are bundled
'hydra._internal.conf.hydra_conf',
'hydra._internal.conf.user_conf',
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
# Exclude unnecessary packages to reduce size
'tkinter', 'test', 'pytest', 'matplotlib.tests', 'numpy.tests',
'onnxscript', 'pysqlite2', 'MySQLdb', 'psycopg2', 'expecttest',
'scipy.tests', 'pandas.tests', 'torch.test', 'PIL.tests', 'torchaudio',
'hypothesis', 'torch.onnx._internal.fx.passes', 'importlib_resources.trees',
'matplotlib.backends.backend_qt', 'matplotlib.backends.backend_qtagg',
'matplotlib.backends.qt_compat', 'PySide6', 'shiboken6',
],
noarchive=False,
optimize=0,
cipher=None,
key=None,
# ---------------------------------------------------------
# UPDATED: Reflect the new module paths for PyInstaller's AST
# ---------------------------------------------------------
collect_all=[
'logic.src.policies',
'logic.src.models',
'logic.src.pipeline',
'logic.src.utils',
'logic.src.interfaces',
'logic.src.envs',
'logic.src.data',
],
collect_submodules=[],
collect_data=[],
collect_entrypoints=[],
strip=False,
upx=True,
upx_exclude=[],
runtime_clean_pkgname=[],
)
# Enable large file support
a.archivename = 'WSmartRoute' # This helps with large files
# Add the Tree imports to a.datas
a.datas += Tree(wandb_path, prefix='wandb')
a.datas += Tree(osmnx_path, prefix='osmnx')
if osmnx_metadata_dir:
a.datas += Tree(osmnx_metadata_dir, prefix=os.path.basename(osmnx_metadata_dir))
pyz = PYZ(a.pure, a.zipped_data, cipher=None)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='WSmartRouteSimulator', # Name of the executable file
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True, # Use 'False' for a GUI application (no command line window)
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='simulator' # Name of the final folder/bundle
)