Skip to content

Commit

Permalink
perf: 优化安装脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Mar 14, 2024
1 parent d77b6a5 commit 21a3963
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
17 changes: 17 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pathlib import Path

import shutil

assets_dir = Path(__file__).parent / "assets"


def configure_ocr_model():
shutil.copytree(
assets_dir / "MaaCommonAssets" / "OCR" / "ppocr_v4" / "zh_cn",
assets_dir / "resource" / "base" / "model" / "ocr",
dirs_exist_ok=True,
)


if __name__ == "__main__":
configure_ocr_model()
11 changes: 6 additions & 5 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
import sys
import json

from configure import configure_ocr_model


working_dir = Path(__file__).parent
install_path = working_dir / Path("install")
version = len(sys.argv) > 1 and sys.argv[1] or "v0.0.1"


if __name__ == "__main__":
shutil.copytree(
working_dir / "deps" / "bin",
Expand All @@ -26,6 +30,8 @@
dirs_exist_ok=True,
)

configure_ocr_model()

shutil.copytree(
working_dir / "assets" / "resource",
install_path / "resource",
Expand All @@ -35,11 +41,6 @@
working_dir / "assets" / "interface.json",
install_path,
)
shutil.copytree(
working_dir / "assets" / "MaaCommonAssets" / "OCR" / "ppocr_v4" / "zh_cn",
install_path / "resource" / "base" / "model" / "ocr",
dirs_exist_ok=True,
)
shutil.copy2(
working_dir / "README.md",
install_path,
Expand Down

0 comments on commit 21a3963

Please sign in to comment.