-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.spec
executable file
·100 lines (91 loc) · 2.66 KB
/
main.spec
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
"""
* Copyright(c) 2024 Sven Trittler
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
"""
import os
import sys
import platform
import importlib.util
# Load version
version_path = 'src/version.py'
spec = importlib.util.spec_from_file_location("version", version_path)
version = importlib.util.module_from_spec(spec)
sys.modules["version"] = version
spec.loader.exec_module(version)
print("CycloneDDS Insight Version:", version.CYCLONEDDS_INSIGHT_VERSION)
# CycloneDDS
cyclonedds_home = os.getenv('CYCLONEDDS_HOME')
if not cyclonedds_home:
raise Exception('CYCLONEDDS_HOME environment variable is not set.')
else:
print('cyclonedds_home: ' + cyclonedds_home)
# CycloneDDS-Python
cyclonedds_python_home = os.getenv('CYCLONEDDS_PYTHON_HOME')
if not cyclonedds_python_home:
raise Exception('CYCLONEDDS_PYTHON_HOME environment variable is not set - must be install via pip install -e .')
else:
print('cyclonedds_python_home: ' + cyclonedds_python_home)
# Add all needed files to the bundle
bins = []
bins.append((f"{cyclonedds_python_home}/cyclonedds/_idlpy.*", '.'))
if platform.system() == 'Windows':
bins.append((f"{cyclonedds_home}/bin/*.dll", '.'))
bins.append((f"{cyclonedds_home}/bin/idlc.exe", '.'))
elif platform.system() == 'Darwin':
bins.append((f"{cyclonedds_home}/bin/idlc", '.'))
elif platform.system() == 'Linux':
bins.append((f"{cyclonedds_home}/bin/idlc", '.'))
bins.append((f"{cyclonedds_home}/lib/*.so*", '.'))
a = Analysis(
['src/main.py'],
pathex=[cyclonedds_python_home],
binaries=bins,
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='CycloneDDS Insight',
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='./res/images/cyclonedds.ico'
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='CycloneDDS Insight',
)
app = BUNDLE(coll,
name='CycloneDDS Insight.app',
icon='./res/images/icon.icns',
bundle_identifier=None,
version=str(version.CYCLONEDDS_INSIGHT_VERSION)
)