Skip to content

Commit

Permalink
chore: 再次优化安装脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
MistEO committed Mar 14, 2024
1 parent 21a3963 commit 1e770af
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
version = len(sys.argv) > 1 and sys.argv[1] or "v0.0.1"


if __name__ == "__main__":
def install_deps():
shutil.copytree(
working_dir / "deps" / "bin",
install_path,
Expand All @@ -21,6 +21,7 @@
"*MaaThriftControlUnit*",
"*MaaWin32ControlUnit*",
"*MaaRpc*",
"*MaaHttp*",
),
dirs_exist_ok=True,
)
Expand All @@ -30,6 +31,9 @@
dirs_exist_ok=True,
)


def install_resource():

configure_ocr_model()

shutil.copytree(
Expand All @@ -41,6 +45,14 @@
working_dir / "assets" / "interface.json",
install_path,
)

with open(install_path / "interface.json", "rw", encoding="utf-8") as f:
interface = json.load(f)
interface["version"] = version
json.dump(interface, f, ensure_ascii=False, indent=4)


def install_chores():
shutil.copy2(
working_dir / "README.md",
install_path,
Expand All @@ -50,10 +62,8 @@
install_path,
)

with open(install_path / "interface.json", "r", encoding="utf-8") as f:
interface = json.load(f)

interface["version"] = version

with open(install_path / "interface.json", "w", encoding="utf-8") as f:
json.dump(interface, f, ensure_ascii=False, indent=4)
if __name__ == "__main__":
install_deps()
install_resource()
install_chores()

0 comments on commit 1e770af

Please sign in to comment.