Skip to content

PyInstaller: エンジン使用時に一時ファイルが残ってしまう問題の修正#503

Merged
Hiroshiba merged 3 commits intoVOICEVOX:pyinstallerfrom
y-chan:feature/remove-onefile-option
Nov 3, 2022
Merged

PyInstaller: エンジン使用時に一時ファイルが残ってしまう問題の修正#503
Hiroshiba merged 3 commits intoVOICEVOX:pyinstallerfrom
y-chan:feature/remove-onefile-option

Conversation

@y-chan
Copy link
Copy Markdown
Member

@y-chan y-chan commented Nov 3, 2022

内容

onefileオプションを用いて生成したspecファイルを使っていたことによる一時ファイルが残る影響を解消する

関連 Issue

ref #439

@y-chan y-chan changed the title remove onefile option from spec file エンジン使用時に一時ファイルが残ってしまう問題の修正 Nov 3, 2022
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 3, 2022

Coverage Result

Resultを開く
Name Stmts Miss Cover
voicevox_engine/init.py 1 0 coverage-100%
voicevox_engine/acoustic_feature_extractor.py 75 0 coverage-100%
voicevox_engine/dev/synthesis_engine/init.py 2 0 coverage-100%
voicevox_engine/dev/synthesis_engine/mock.py 36 2 coverage-94%
voicevox_engine/full_context_label.py 162 3 coverage-98%
voicevox_engine/kana_parser.py 86 1 coverage-99%
voicevox_engine/model.py 154 7 coverage-95%
voicevox_engine/mora_list.py 4 0 coverage-100%
voicevox_engine/part_of_speech_data.py 5 0 coverage-100%
voicevox_engine/preset/Preset.py 12 0 coverage-100%
voicevox_engine/preset/PresetLoader.py 34 1 coverage-97%
voicevox_engine/preset/init.py 3 0 coverage-100%
voicevox_engine/synthesis_engine/init.py 5 0 coverage-100%
voicevox_engine/synthesis_engine/core_wrapper.py 199 159 coverage-20%
voicevox_engine/synthesis_engine/make_synthesis_engines.py 48 39 coverage-19%
voicevox_engine/synthesis_engine/synthesis_engine.py 133 12 coverage-91%
voicevox_engine/synthesis_engine/synthesis_engine_base.py 66 9 coverage-86%
voicevox_engine/user_dict.py 131 10 coverage-92%
voicevox_engine/utility/init.py 3 0 coverage-100%
voicevox_engine/utility/connect_base64_waves.py 35 3 coverage-91%
voicevox_engine/utility/engine_root.py 9 2 coverage-78%
TOTAL 1203 248 coverage-79%

@y-chan y-chan changed the title エンジン使用時に一時ファイルが残ってしまう問題の修正 PyInstaller: エンジン使用時に一時ファイルが残ってしまう問題の修正 Nov 3, 2022
@y-chan y-chan marked this pull request as ready for review November 3, 2022 15:56
Copy link
Copy Markdown
Member Author

@y-chan y-chan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

いくつか疑問が出そうな場所にコメントしてみました。

PyInstallerのonefileオプションを使えば、実行時に一時ファイル/フォルダが生成されることを調べ逃していたこと、とりあえずエンジンの容量を減らせた方が利益が大きいのではないかと考えて、specファイルを用いて生成するように方針転換した時に、勝手にonefileオプションを適用してspecファイルを作ったことなど、私の浅はかさが招いた問題でした...申し訳ないです...

Comment on lines -451 to -453
# pysoundfile
ln -sf "${{ env.PYTHON_SITE_PACKAGES_DIR }}/_soundfile_data" dist/run.dist/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onefileオプションを取り払ったことで、pyinstallerが勝手にpysoundfileのデータを移行してくれるので、不要になりました(そもそもpyinstallerに移行した時点でこのコピーは不要だった可能性がありますが...)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

調整が必要な場所の調査と反映、ありがとうございます!!

Comment thread run.spec
Comment on lines -87 to +80
name='run.dist',
name='run',
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onefileを使用して、かつ必要なフォルダ(speaker_info/engine_manifest_assets)やファイル(default.csv/onnxruntime.dllなど)のコピー処理も行う場合、成果物が生成されるdistフォルダ内にrunという実行ファイルとrunというフォルダが生成されることになり、この場合ファイル操作が壊れることがあるので、出力フォルダ名をrun.distと変更するためにこのような変更をしていました。
onefileを使用しなくなったことで、distフォルダ内にはrunフォルダのみが生成されるようになったので、名前を戻しました。(CIの変更もこれによるものです)

Copy link
Copy Markdown
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

PRありがとうございます!!
VOICEVOXはまだPyInstaller版をリリースしていないので影響はありませんので、お気になさらず・・・!

@Hiroshiba
Copy link
Copy Markdown
Member

多分大丈夫だと思うのと、pyinstallerブランチへのマージということで、1人approveでマージしたいと思います!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants