-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathrun.spec
More file actions
86 lines (75 loc) · 2.4 KB
/
run.spec
File metadata and controls
86 lines (75 loc) · 2.4 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
# -*- mode: python ; coding: utf-8 -*-
# このファイルは元々 PyInstaller によって自動生成されたもので、それをカスタマイズして使用しています。
import sys
from pathlib import Path
from shutil import copy2, copytree
from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs
datas = []
datas += collect_data_files('e2k')
datas += collect_data_files('pyopenjtalk')
datas += collect_data_files('style_bert_vits2')
# functorch のバイナリを収集
# ONNX に移行したため不要なはずだが、念のため
binaries = collect_dynamic_libs('functorch')
# Windows: Intel MKL 関連の DLL を収集
# これをやらないと PyTorch が CPU 版か CUDA 版かに関わらずクラッシュする…
# ONNX に移行したため不要なはずだが、念のため
if sys.platform == 'win32':
lib_dir_path = Path(sys.prefix) / 'Library' / 'bin'
if lib_dir_path.exists():
mkl_dlls = list(lib_dir_path.glob('*.dll'))
for dll in mkl_dlls:
binaries.append((str(dll), '.'))
a = Analysis(
['run.py'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
module_collection_mode={
# Style-Bert-VITS2 内部で使われている TorchScript (@torch.jit) による問題を回避するために必要
'style_bert_vits2': 'pyz+py',
},
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='run',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
contents_directory='engine_internal', # 実行時に sys._MEIPASS が参照するディレクトリ名
)
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='run',
)
# 実行ファイルのディレクトリに配置するファイルのコピー
target_dir = Path(DISTPATH) / 'run'
# リソースをコピー
manifest_file_path = Path('engine_manifest.json')
copy2(manifest_file_path, target_dir)
copytree('resources', target_dir / 'resources')
license_file_path = Path('licenses.json')
if license_file_path.is_file():
copy2(license_file_path, target_dir)