Skip to content
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

[release-0.15] #857 をrevert #1023

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,10 @@ jobs:
LIBONNXRUNTIME_PATH=download/onnxruntime/lib/libonnxruntime.so
fi

pyinstaller --noconfirm run.spec -- \
--libcore_path="$LIBCORE_PATH" \
--libonnxruntime_path="$LIBONNXRUNTIME_PATH" \
--core_model_dir_path="download/core/model"
CORE_MODEL_DIR_PATH="download/core/model" \
LIBCORE_PATH="$LIBCORE_PATH" \
LIBONNXRUNTIME_PATH="$LIBONNXRUNTIME_PATH" \
pyinstaller --noconfirm run.spec

- name: Gather DLL dependencies to dist/run/ (Windows)
if: startsWith(matrix.os, 'windows-')
Expand Down
61 changes: 30 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ platformdirs = "^3.10.0"
soxr = "^0.3.6"

[tool.poetry.group.dev.dependencies]
pyinstaller = "^6.2.0"
pyinstaller = "^5.13"
pre-commit = "^2.16.0"
poetry = "^1.3.1"

Expand Down
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
altgraph==0.17.4 ; python_version >= "3.11" and python_version < "3.12"
altgraph==0.17.3 ; python_version >= "3.11" and python_version < "3.12"
anyio==3.7.1 ; python_version >= "3.11" and python_version < "3.12"
asgiref==3.7.2 ; python_version >= "3.11" and python_version < "3.12"
attrs==23.1.0 ; python_version >= "3.11" and python_version < "3.12"
Expand Down Expand Up @@ -28,7 +28,7 @@ jeepney==0.8.0 ; python_version >= "3.11" and python_version < "3.12" and sys_pl
jinja2==3.1.2 ; python_version >= "3.11" and python_version < "3.12"
jsonschema==4.17.3 ; python_version >= "3.11" and python_version < "3.12"
keyring==24.2.0 ; python_version >= "3.11" and python_version < "3.12"
macholib==1.16.3 ; python_version >= "3.11" and python_version < "3.12" and sys_platform == "darwin"
macholib==1.16.2 ; python_version >= "3.11" and python_version < "3.12" and sys_platform == "darwin"
markupsafe==2.1.3 ; python_version >= "3.11" and python_version < "3.12"
more-itertools==10.1.0 ; python_version >= "3.11" and python_version < "3.12"
msgpack==1.0.5 ; python_version >= "3.11" and python_version < "3.12"
Expand All @@ -46,8 +46,8 @@ pre-commit==2.21.0 ; python_version >= "3.11" and python_version < "3.12"
ptyprocess==0.7.0 ; python_version >= "3.11" and python_version < "3.12"
pycparser==2.21 ; python_version >= "3.11" and python_version < "3.12"
pydantic==1.10.12 ; python_version >= "3.11" and python_version < "3.12"
pyinstaller-hooks-contrib==2023.10 ; python_version >= "3.11" and python_version < "3.12"
pyinstaller==6.2.0 ; python_version >= "3.11" and python_version < "3.12"
pyinstaller-hooks-contrib==2023.7 ; python_version >= "3.11" and python_version < "3.12"
pyinstaller==5.13.2 ; python_version >= "3.11" and python_version < "3.12"
pyopenjtalk @ git+https://github.com/VOICEVOX/pyopenjtalk@b35fc89fe42948a28e33aed886ea145a51113f88 ; python_version >= "3.11" and python_version < "3.12"
pyproject-hooks==1.0.0 ; python_version >= "3.11" and python_version < "3.12"
pyrsistent==0.19.3 ; python_version >= "3.11" and python_version < "3.12"
Expand All @@ -60,7 +60,7 @@ requests-toolbelt==1.0.0 ; python_version >= "3.11" and python_version < "3.12"
requests==2.31.0 ; python_version >= "3.11" and python_version < "3.12"
secretstorage==3.3.3 ; python_version >= "3.11" and python_version < "3.12" and sys_platform == "linux"
semver==3.0.1 ; python_version >= "3.11" and python_version < "3.12"
setuptools==69.0.2 ; python_version >= "3.11" and python_version < "3.12"
setuptools==68.1.2 ; python_version >= "3.11" and python_version < "3.12"
shellingham==1.5.3 ; python_version >= "3.11" and python_version < "3.12"
six==1.16.0 ; python_version >= "3.11" and python_version < "3.12"
sniffio==1.3.0 ; python_version >= "3.11" and python_version < "3.12"
Expand Down
3 changes: 1 addition & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
engine_root,
get_latest_core_version,
get_save_dir,
internal_root,
)
from voicevox_engine.utility.run_utility import decide_boolean_from_env

Expand Down Expand Up @@ -228,7 +227,7 @@ def check_disabled_mutable_api():
metas_store = MetasStore(root_dir / "speaker_info")

setting_ui_template = Jinja2Templates(
directory=internal_root() / "ui_template",
directory=engine_root() / "ui_template",
variable_start_string="<JINJA_PRE>",
variable_end_string="<JINJA_POST>",
)
Expand Down
88 changes: 36 additions & 52 deletions run.spec
Original file line number Diff line number Diff line change
@@ -1,42 +1,49 @@
# -*- mode: python ; coding: utf-8 -*-
# このファイルはPyInstallerによって自動生成されたもので、それをカスタマイズして使用しています。
from argparse import ArgumentParser
from pathlib import Path
from shutil import copy2, copytree

from PyInstaller.utils.hooks import collect_data_files

parser = ArgumentParser()
parser.add_argument("--libcore_path", type=Path)
parser.add_argument("--libonnxruntime_path", type=Path)
parser.add_argument("--core_model_dir_path", type=Path)
options = parser.parse_args()

libonnxruntime_path: Path | None = options.libonnxruntime_path
if libonnxruntime_path is not None and not libonnxruntime_path.is_file():
raise Exception(f"libonnxruntime_path: {libonnxruntime_path} is not file")

libcore_path: Path | None = options.libcore_path
if libcore_path is not None and not libcore_path.is_file():
raise Exception(f"libcore_path: {libcore_path} is not file")

core_model_dir_path: Path | None = options.core_model_dir_path
if core_model_dir_path is not None and not core_model_dir_path.is_dir():
raise Exception(f"core_model_dir_path: {core_model_dir_path} is not dir")
import os

datas = [
("default.csv", "."),
("presets.yaml", "."),
("ui_template", "ui_template"),
('engine_manifest_assets', 'engine_manifest_assets'),
('speaker_info', 'speaker_info'),
('engine_manifest.json', '.'),
('default.csv', '.'),
('licenses.json', '.'),
('presets.yaml', '.'),
('ui_template', 'ui_template'),
]
datas += collect_data_files("pyopenjtalk")
datas += collect_data_files('pyopenjtalk')

core_model_dir_path = os.environ.get('CORE_MODEL_DIR_PATH')
if core_model_dir_path:
print('CORE_MODEL_DIR_PATH is found:', core_model_dir_path)
if not os.path.isdir(core_model_dir_path):
raise Exception("CORE_MODEL_DIR_PATH was found, but it is not directory!")
datas += [(core_model_dir_path, "model")]

# コアと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


a = Analysis(
["run.py"],
['run.py'],
pathex=[],
binaries=[],
datas=datas,
Expand All @@ -58,7 +65,7 @@ exe = EXE(
a.scripts,
[],
exclude_binaries=True,
name="run",
name='run',
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand All @@ -69,7 +76,6 @@ exe = EXE(
target_arch=None,
codesign_identity=None,
entitlements_file=None,
contents_directory="engine_internal",
)

coll = COLLECT(
Expand All @@ -80,27 +86,5 @@ coll = COLLECT(
strip=False,
upx=True,
upx_exclude=[],
name="run",
name='run',
)

# 実行ファイル作成後の処理

# 実行ファイルと同じrootディレクトリ
target_dir = Path(DISTPATH) / "run"

# 動的ライブラリをコピー
if libonnxruntime_path is not None:
copy2(libonnxruntime_path, target_dir)
if libcore_path is not None:
copy2(libcore_path, target_dir)
if core_model_dir_path is not None:
copytree(core_model_dir_path, target_dir / "model")

# 互換性維持のために必要なファイルをコピー
license_file_path = Path("licenses.json")
if license_file_path.is_file():
copy2("licenses.json", target_dir)

copytree("speaker_info", target_dir / "speaker_info")
copy2("engine_manifest.json", target_dir)
copytree("engine_manifest_assets", target_dir / "engine_manifest_assets")
4 changes: 2 additions & 2 deletions voicevox_engine/user_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

from .model import UserDictWord, WordTypes
from .part_of_speech_data import MAX_PRIORITY, MIN_PRIORITY, part_of_speech_data
from .utility import get_save_dir, internal_root, mutex_wrapper
from .utility import engine_root, get_save_dir, mutex_wrapper

root_dir = internal_root()
root_dir = engine_root()
save_dir = get_save_dir()

if not save_dir.is_dir():
Expand Down
5 changes: 2 additions & 3 deletions voicevox_engine/utility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
)
from .core_version_utility import get_latest_core_version, parse_core_version
from .mutex_utility import mutex_wrapper
from .path_utility import delete_file, engine_root, get_save_dir, internal_root
from .path_utility import delete_file, engine_root, get_save_dir

__all__ = [
"ConnectBase64WavesException",
"connect_base64_waves",
"decode_base64_waves",
"get_latest_core_version",
"parse_core_version",
"mutex_wrapper",
"delete_file",
"engine_root",
"get_save_dir",
"internal_root",
"mutex_wrapper",
]
Loading