forked from danielhrisca/asammdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
asammdf.spec
122 lines (103 loc) · 2.7 KB
/
asammdf.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# -*- mode: python -*-
import argparse
from pathlib import Path
import site
import sys
asammdf_path = Path.cwd() / "asammdf" / "gui" / "asammdfgui.py"
def _cmd_line_parser():
parser = argparse.ArgumentParser()
parser.add_argument(
"spec",
help="specfile",
)
parser.add_argument(
"--console",
action="store_true",
help="show console, default False",
)
parser.add_argument(
"--onefile",
action="store_true",
help="create single file, default False",
)
return parser
parser = _cmd_line_parser()
args, unknown = parser.parse_known_args(sys.argv[1:])
block_cipher = None
added_files = []
for root, dirs, files in os.walk(asammdf_path.parent / "ui"):
for file in files:
if file.lower().endswith(("ui", "png", "qrc")):
added_files.append(
(os.path.join(root, file), os.path.join("asammdf", "gui", "ui"))
)
import pyqtlet
pyqtlet_path = Path(pyqtlet.__path__[0]).resolve()
site_packages = pyqtlet_path.parent
site_packages_str = os.path.join(str(site_packages), "")
for root, dirs, files in os.walk(pyqtlet_path):
for file in files:
if not file.lower().endswith(("py", "pyw")):
file_name = os.path.join(root, file)
dest = root.replace(site_packages_str, "")
added_files.append((file_name, dest))
a = Analysis(
[asammdf_path],
pathex=[],
binaries=[],
datas=added_files,
hiddenimports=[
"numpy.core._dtype_ctypes",
"canmatrix.formats",
"canmatrix.formats.dbc",
"canmatrix.formats.arxml",
"asammdf.blocks.cutils",
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=not args.onefile,
)
if args.onefile:
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
Tree(asammdf_path.parent),
name="asammdfgui",
debug=False,
strip=False,
upx=True,
console=args.console,
icon="asammdf.ico",
)
else:
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
name="asammdfgui",
exclude_binaries=True,
bootloader_ignore_signals=False,
debug=False,
strip=False,
console=args.console,
icon="asammdf.ico",
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
Tree(asammdf_path.parent),
upx=False,
upx_exclude=[],
name="asammdfgui",
)