| 146 | |
| 147 | |
| 148 | def 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 | |
| 169 | def bootstrap_maadeps(skip_if_exist: bool = True) -> bool: |