diff --git a/src/chsrc-main.c b/src/chsrc-main.c index 67feb71..010efe0 100644 --- a/src/chsrc-main.c +++ b/src/chsrc-main.c @@ -654,9 +654,9 @@ main (int argc, char const *argv[]) if (CliOpt_DryRun) { - char *dry_msg = CliOpt_InEnglish ? "** Enable [Dry Run] mode. " \ + char *dry_msg = CliOpt_InEnglish ? "**Enable [Dry Run] mode. " \ "Simulate the source changing process (skipping speed measurement). " \ - "Commands only print but don't run **\n" + "Commands only print but don't run**\n" : "**开启Dry Run模式,模拟换源过程(跳过测速),命令仅打印并不运行**\n"; chsrc_log (bdyellow(dry_msg)); } diff --git a/src/recipe/lang/Node.js/Node.js.c b/src/recipe/lang/Node.js/Node.js.c index 7e052da..abb5e94 100644 --- a/src/recipe/lang/Node.js/Node.js.c +++ b/src/recipe/lang/Node.js/Node.js.c @@ -63,10 +63,10 @@ void pl_nodejs_setsrc (char *option) { { - char *msg = CliOpt_InEnglish ? "** Three package managers will be replaced for you at the same time: " \ + char *msg = CliOpt_InEnglish ? "**Three package managers will be replaced for you at the same time: " \ "npm, pnpm, yarn. If you need to change the source independently, " \ - "please run independently `chsrc set ` **\n" - : "** 将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set **\n"; + "please run independently `chsrc set `**\n" + : "**将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set **\n"; chsrc_log (bdyellow(msg)); } diff --git a/src/recipe/lang/Python/PDM.c b/src/recipe/lang/Python/PDM.c index b0a6997..716f1c5 100644 --- a/src/recipe/lang/Python/PDM.c +++ b/src/recipe/lang/Python/PDM.c @@ -4,30 +4,9 @@ * File Authors : Aoran Zeng * Contributors : Nul None * Created On : <2024-06-05> - * Last Modified : <2024-09-13> + * Last Modified : <2024-09-14> * ------------------------------------------------------------*/ -/** - * @update 2024-05-24 - * @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna - */ -static SourceInfo -pl_python_pdm_sources[] = { - {&Upstream, "https://pypi.org/simple"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"}, - {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"}, - {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple"}, - {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple"}, - {&Ali, "https://mirrors.aliyun.com/pypi/simple/"}, - {&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple"}, - {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"}, - {&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"} - // {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次 -}; -def_sources_n(pl_python_pdm); - - /** * chsrc get pdm */ @@ -49,7 +28,10 @@ pl_python_pdm_getsrc (char *option) void pl_python_pdm_setsrc (char *option) { - chsrc_yield_source_and_confirm (pl_python_pdm); + SourceInfo source; + chsrc_yield_the_source (pl_python); + if (ProgMode_Target_Group!=true) + chsrc_confirm_source; char *cmd = NULL; @@ -96,4 +78,5 @@ pl_python_pdm_feat (char *option) return fi; } -def_target_gsrf(pl_python_pdm); +// def_target_gsrf(pl_python_pdm); +TargetInfo pl_python_pdm_target = {def_target_inner_gsrf(pl_python_pdm),def_target_sourcesn(pl_python)}; diff --git a/src/recipe/lang/Python/Poetry.c b/src/recipe/lang/Python/Poetry.c index cd5c53a..c37969f 100644 --- a/src/recipe/lang/Python/Poetry.c +++ b/src/recipe/lang/Python/Poetry.c @@ -4,33 +4,11 @@ * File Authors : Aoran Zeng * Contributors : Nil Null * Created On : <2024-08-08> - * Last Modified : <2024-09-13> + * Last Modified : <2024-09-14> * ------------------------------------------------------------*/ // @note Poetry 默认使用项目级换源 - -/** - * @update 2024-05-24 - * @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna - */ -static SourceInfo -pl_python_poetry_sources[] = { - {&Upstream, "https://pypi.org/simple"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"}, - {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"}, - {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple"}, - {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple"}, - {&Ali, "https://mirrors.aliyun.com/pypi/simple/"}, - {&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple"}, - {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"}, - {&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"} - // {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次 -}; -def_sources_n(pl_python_poetry); - - /** * chsrc get poetry */ @@ -49,7 +27,10 @@ pl_python_poetry_getsrc (char *option) void pl_python_poetry_setsrc (char *option) { - chsrc_yield_source_and_confirm (pl_python_poetry); + SourceInfo source; + chsrc_yield_the_source (pl_python); + if (ProgMode_Target_Group!=true) + chsrc_confirm_source; char *cmd = NULL; @@ -93,4 +74,5 @@ pl_python_poetry_feat (char *option) return fi; } -def_target_gsrf(pl_python_poetry); +// def_target_gsrf(pl_python_poetry); +TargetInfo pl_python_poetry_target = {def_target_inner_gsrf(pl_python_poetry),def_target_sourcesn(pl_python)}; diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index 6c52600..8190f63 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -9,28 +9,6 @@ * 2024-08-08: uv 似乎暂时没有实现换源 * ------------------------------------------------------------*/ -/** - * @update 2024-05-24 - * @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna - */ -static SourceInfo -pl_python_sources[] = { - {&Upstream, "https://pypi.org/simple"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"}, - {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"}, - {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple"}, - {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple"}, - {&Ali, "https://mirrors.aliyun.com/pypi/simple/"}, - {&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple"}, - {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"}, - {&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"} - // {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次 -}; - -def_sources_n(pl_python); - - void pl_python_getsrc (char *option) { @@ -59,6 +37,14 @@ pl_python_getsrc (char *option) void pl_python_setsrc (char *option) { + { + char *msg = CliOpt_InEnglish ? "**Three package managers will be replaced for you at the same time: " \ + "pip, Poetry, PDM. If you need to change the source independently, " \ + "please run independently `chsrc set `**\n" + : "**将同时为您更换3个包管理器 pip, Poetry, PDM 的源,若需要独立换源,请独立运行 chsrc set **\n"; + chsrc_log (bdyellow(msg)); + } + char *chsrc_type = xy_streql (option, ChsrcTypeReset) ? ChsrcTypeReset : ChsrcTypeAuto; bool pdm_exist = false, @@ -66,7 +52,9 @@ pl_python_setsrc (char *option) pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); - // chsrc_yield_source_and_confirm (pl_python); + ProgMode_Target_Group = true; + chsrc_yield_source_and_confirm (pl_python); + // 交给后面检查命令的存在性 pl_python_pip_setsrc (option); diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index f880531..07bd9ce 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -8,6 +8,26 @@ * Last Modified : <2024-09-13> * ------------------------------------------------------------*/ +/** + * @update 2024-05-24 + * @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna + */ +static SourceInfo +pl_python_sources[] = { + {&Upstream, "https://pypi.org/simple"}, + {&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"}, + {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"}, + {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"}, + {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple"}, + {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple"}, + {&Ali, "https://mirrors.aliyun.com/pypi/simple/"}, + {&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple"}, + {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"}, + {&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"} + // {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次 +}; +def_sources_n(pl_python); + void pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist) { diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index ff77b40..f481eb1 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -4,30 +4,9 @@ * File Authors : Aoran Zeng * Contributors : Nul None * Created On : <2023-09-03> - * Last Modified : <2024-09-13> + * Last Modified : <2024-09-14> * ------------------------------------------------------------*/ -/** - * @update 2024-05-24 - * @note 不要添加Zju,浙大的pypi在校外访问会自动转向Tuna - */ -static SourceInfo -pl_python_pip_sources[] = { - {&Upstream, "https://pypi.org/simple"}, - {&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple"}, - {&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple"}, - {&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple"}, - {&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple"}, - {&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple"}, - {&Ali, "https://mirrors.aliyun.com/pypi/simple/"}, - {&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple"}, - {&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple"}, - {&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple"} - // {&Netease, "https://mirrors.163.com/.help/pypi.html"} // 不用,24小时更新一次 -}; -def_sources_n(pl_python_pip); - - /** * chsrc get pip */ @@ -59,7 +38,10 @@ pl_python_pip_setsrc (char *option) return; } - chsrc_yield_source_and_confirm (pl_python_pip); + SourceInfo source; + chsrc_yield_the_source (pl_python); + if (ProgMode_Target_Group!=true) + chsrc_confirm_source; char *py_prog_name = NULL; pl_python_get_py_program_name (&py_prog_name); @@ -105,4 +87,5 @@ pl_python_pip_feat (char *option) return fi; } -def_target_gsrf(pl_python_pip); +// def_target_gsrf(pl_python_pip); +TargetInfo pl_python_pip_target = {def_target_inner_gsrf(pl_python_pip),def_target_sourcesn(pl_python)};