-
Notifications
You must be signed in to change notification settings - Fork 248
PyInstaller: エンジン使用時に一時ファイルが残ってしまう問題の修正 #503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,31 @@ | |
| from PyInstaller.utils.hooks import collect_data_files | ||
| import os | ||
|
|
||
| datas = collect_data_files('pyopenjtalk') | ||
| datas = [ | ||
| ('engine_manifest_assets', 'engine_manifest_assets'), | ||
| ('speaker_info', 'speaker_info'), | ||
| ('default.csv', '.'), | ||
| ('licenses.json', '.'), | ||
| ('presets.yaml', '.'), | ||
| ] | ||
| datas += collect_data_files('pyopenjtalk') | ||
|
|
||
| # コアとONNX Runtimeはバイナリであるが、`binaries`に加えると | ||
| # 依存関係のパスがPyInstallerに書き換えらるので、`datas`に加える | ||
| # 参考: https://github.com/VOICEVOX/voicevox_engine/pull/446#issuecomment-1210052318 | ||
| libcore_path = os.environ.get('LIBCORE_PATH') | ||
| if libcore_path: | ||
| print('LIBCORE_PATH is found:', libcore_path) | ||
| if not os.path.isfile(libcore_path): | ||
| raise Exception("LIBCORE_PATH was found, but it is not file!") | ||
| datas += [(libcore_path, ".")] | ||
|
|
||
| libonnxruntime_path = os.environ.get('LIBONNXRUNTIME_PATH') | ||
| if libonnxruntime_path: | ||
| print('LIBONNXRUNTIME_PATH is found:', libonnxruntime_path) | ||
| if not os.path.isfile(libonnxruntime_path): | ||
| raise Exception("LIBCORE_PATH was found, but it is not file!") | ||
| datas += [(libonnxruntime_path, ".")] | ||
|
|
||
|
|
||
| block_cipher = None | ||
|
|
@@ -30,17 +54,13 @@ pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | |
| exe = EXE( | ||
| pyz, | ||
| a.scripts, | ||
| a.binaries, | ||
| a.zipfiles, | ||
| a.datas, | ||
| [], | ||
| exclude_binaries=True, | ||
| name='run', | ||
| debug=False, | ||
| bootloader_ignore_signals=False, | ||
| strip=False, | ||
| upx=True, | ||
| upx_exclude=[], | ||
| runtime_tmpdir=None, | ||
| console=True, | ||
| disable_windowed_traceback=False, | ||
| argv_emulation=False, | ||
|
|
@@ -49,40 +69,13 @@ exe = EXE( | |
| entitlements_file=None, | ||
| ) | ||
|
|
||
| datas = [ | ||
| ('engine_manifest_assets', 'engine_manifest_assets', 'DATA'), | ||
| ('speaker_info', 'speaker_info', 'DATA'), | ||
| ('default.csv', 'default.csv', 'DATA'), | ||
| ('licenses.json', 'licenses.json', 'DATA'), | ||
| ('presets.yaml', 'presets.yaml', 'DATA'), | ||
| ] | ||
|
|
||
| # コアとONNX Runtimeはバイナリであるが、`binaries`に加えると | ||
| # 依存関係のパスがPyInstallerに書き換えらるので、`datas`に加える | ||
| # 参考: https://github.com/VOICEVOX/voicevox_engine/pull/446#issuecomment-1210052318 | ||
| libcore_path = os.environ.get('LIBCORE_PATH') | ||
| if libcore_path: | ||
| print('LIBCORE_PATH is found:', libcore_path) | ||
| if not os.path.isfile(libcore_path): | ||
| raise Exception("LIBCORE_PATH was found, but it is not file!") | ||
| filename = os.path.basename(libcore_path) | ||
| datas += [(filename, libcore_path, 'DATA')] | ||
|
|
||
| libonnxruntime_path = os.environ.get('LIBONNXRUNTIME_PATH') | ||
| if libonnxruntime_path: | ||
| print('LIBONNXRUNTIME_PATH is found:', libonnxruntime_path) | ||
| if not os.path.isfile(libonnxruntime_path): | ||
| raise Exception("LIBCORE_PATH was found, but it is not file!") | ||
| filename = os.path.basename(libonnxruntime_path) | ||
| datas += [(filename, libonnxruntime_path, 'DATA')] | ||
|
|
||
| coll = COLLECT( | ||
| exe, | ||
| [], | ||
| [], | ||
| datas, | ||
| a.binaries, | ||
| a.zipfiles, | ||
| a.datas, | ||
| strip=False, | ||
| upx=True, | ||
| upx_exclude=[], | ||
| name='run.dist', | ||
| name='run', | ||
|
Comment on lines
-87
to
+80
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onefileを使用して、かつ必要なフォルダ( |
||
| ) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onefileオプションを取り払ったことで、pyinstallerが勝手にpysoundfileのデータを移行してくれるので、不要になりました(そもそもpyinstallerに移行した時点でこのコピーは不要だった可能性がありますが...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
調整が必要な場所の調査と反映、ありがとうございます!!