-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.spec
112 lines (99 loc) · 2.86 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
101
102
103
104
105
106
107
108
109
110
111
112
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.win32 import versioninfo as vi
from pathlib import Path
import importlib.util
version = (1, 5, 4, 0)
version_file = vi.VSVersionInfo(
ffi=vi.FixedFileInfo(
filevers=version,
prodvers=version,
mask=0x3f,
flags=0x0,
OS=0x4,
fileType=0x1,
subtype=0x0,
date=(0, 0)
),
kids=[
vi.StringFileInfo([
vi.StringTable(
u'040904B0', [
vi.StringStruct(u'FileDescription', u'Simple Wuthering Waves Inventory scanner.'),
vi.StringStruct(u'FileVersion', '.'.join(map(str, version))),
vi.StringStruct(u'InternalName', u'WuWaInventoryKamera'),
vi.StringStruct(u'OriginalFilename', u'WuWa_Inventory_Kamera.exe'),
vi.StringStruct(u'ProductName', u'WuWa Inventory Kamera'),
vi.StringStruct(u'ProductVersion', '.'.join(map(str, version)))
])
]),
vi.VarFileInfo([vi.VarStruct(u'Translation', [0x0409, 0x04B0])])
]
)
def check_package_exists(package_name):
package_spec = importlib.util.find_spec(package_name)
return package_spec is not None
if check_package_exists('rapidocr_onnxruntime'):
package_name = 'rapidocr_onnxruntime'
package = __import__(package_name)
install_dir = Path(package.__file__).resolve().parent
file_paths = {
'onnx': list(install_dir.rglob('*.onnx')),
'txt': list(install_dir.rglob('*.txt')),
'yaml': list(install_dir.rglob('*.yaml'))
}
add_data = []
for ext in ['onnx', 'txt']:
for path in file_paths[ext]:
rel_dir = path.parent.relative_to(install_dir)
add_data.append((str(path.parent), f'{package_name}/{rel_dir}'))
for path in file_paths['yaml']:
rel_dir = path.parent.relative_to(install_dir)
if rel_dir == Path('.'):
add_data.append((str(path.parent / '*.yaml'), package_name))
else:
add_data.append((str(path.parent / '*.yaml'), f'{package_name}/{rel_dir}'))
add_data = list(set(add_data))
else:
add_data = []
a = Analysis(
['main.py'],
pathex=[],
binaries=[],
datas=[
('assets', 'assets'),
*add_data
],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='WuWa Inventory Kamera',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
icon='./assets/icon.ico',
version=version_file
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='main',
bindir='_internal'
)