forked from danielhrisca/asammdf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasammdf.spec
114 lines (97 loc) · 2.56 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
# -*- mode: python -*-
import sys
import site
from pathlib import Path
if sys.platform.startswith('linux'):
asammdf_path = Path('/home/appveyor/venv3.7/lib/python3.7/site-packages/asammdf/gui/asammdfgui.py')
elif sys.platform.startswith('win'):
asammdf_path = Path(site.getsitepackages()[1]) / 'asammdf' / 'gui' / 'asammdfgui.py'
else:
asammdf_path = Path('/Users/appveyor/venv3.7/lib/python3.7/site-packages/asammdf/gui/asammdfgui.py')
import argparse
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')))
a = Analysis([asammdf_path],
pathex=[],
binaries=[],
datas=added_files,
hiddenimports=[
'numpy.core._dtype_ctypes',
'canmatrix.formats',
'canmatrix.formats.dbc',
'canmatrix.formats.arxml',
],
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'
)