MCPcopy
hub / github.com/MaaEnd/MaaEnd / update_submodules

Function update_submodules

tools/setup_workspace.py:148–166  ·  view source on GitHub ↗
(skip_if_exist: bool = True)

Source from the content-addressed store, hash-verified

146
147
148def update_submodules(skip_if_exist: bool = True) -> bool:
149 print(Console.hdr(t("inf_check_submodules")))
150
151 # 兼容旧版本:model 可能是普通文件夹而非子模块,需要删除以确保子模块正常 clone
152 model_path = PROJECT_BASE / "assets" / "resource" / "model"
153 if model_path.is_dir() and not (model_path / "LICENSE").exists():
154 print(Console.warn(t("wrn_model_not_submodule", path=model_path)))
155 shutil.rmtree(model_path)
156 print(Console.ok(t("inf_model_dir_removed", path=model_path)))
157
158 if (
159 not skip_if_exist
160 or not (model_path / "LICENSE").exists()
161 or not (PROJECT_BASE / "agent" / "cpp-algo" / "MaaUtils" / "MaaUtils.cmake").exists()
162 ):
163 print(Console.info(t("inf_updating_submodules")))
164 return run_command(["git", "submodule", "update", "--init", "--recursive"])
165 print(Console.ok(t("inf_submodules_exist")))
166 return True
167
168
169def bootstrap_maadeps(skip_if_exist: bool = True) -> bool:

Callers 1

mainFunction · 0.85

Calls 6

run_commandFunction · 0.85
hdrMethod · 0.80
warnMethod · 0.80
okMethod · 0.80
infoMethod · 0.80
tFunction · 0.70

Tested by

no test coverage detected