MCPcopy
hub / github.com/MaaEnd/MaaEnd / copy_cpp_algo_binary

Function copy_cpp_algo_binary

tools/setup_workspace.py:879–903  ·  view source on GitHub ↗
(src_path: Path, install_root: Path)

Source from the content-addressed store, hash-verified

877
878
879def copy_cpp_algo_binary(src_path: Path, install_root: Path) -> None:
880 agent_dir = install_root / "agent"
881 agent_dir.mkdir(parents=True, exist_ok=True)
882
883 target_path = agent_dir / CPP_ALGO_DIST_NAME
884 _replace_file_with_retry(src_path, target_path)
885 print(Console.ok(t("inf_updated_file", name=target_path.name)))
886
887 if OS_KEYWORD != "win":
888 target_path.chmod(target_path.stat().st_mode | 0o111)
889
890 pdb_src = src_path.with_suffix(".pdb")
891 if pdb_src.exists():
892 pdb_target = agent_dir / f"{Path(CPP_ALGO_DIST_NAME).stem}.pdb"
893 _replace_file_with_retry(pdb_src, pdb_target)
894 print(Console.ok(t("inf_updated_file", name=pdb_target.name)))
895
896 for companion_name in CPP_ALGO_COMPANION_FILES:
897 companion_src = src_path.parent / companion_name
898 if not companion_src.exists():
899 print(Console.warn(t("wrn_cpp_algo_companion_missing", name=companion_name)))
900 continue
901 companion_target = agent_dir / companion_name
902 _replace_file_with_retry(companion_src, companion_target)
903 print(Console.ok(t("inf_updated_file", name=companion_target.name)))
904
905
906def _github_auth_headers() -> dict[str, str] | None:

Callers 1

install_cpp_algoFunction · 0.85

Calls 4

_replace_file_with_retryFunction · 0.85
okMethod · 0.80
warnMethod · 0.80
tFunction · 0.70

Tested by

no test coverage detected