diff --git a/src/chsrc-framework.h b/src/chsrc-framework.h index 8b9aa49..25fa5b4 100644 --- a/src/chsrc-framework.h +++ b/src/chsrc-framework.h @@ -341,7 +341,7 @@ query_mirror_exist (SourceInfo *sources, size_t size, char *target, char *input) if (xy_streql ("first", input)) { - char *msg = CliOpt_InEnglish ? "Will use the first speed source measured by maintainers" : "将使用维护团队测速第一的源"; + char *msg = CliOpt_InEnglish ? "Will use the first speedy source measured by maintainers" : "将使用维护团队测速第一的源"; say (msg); return 1; // 返回第2个,因为第1个是上游默认源 } diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index bcfcd9d..6c52600 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -34,53 +34,14 @@ def_sources_n(pl_python); void pl_python_getsrc (char *option) { - char *prog_name = NULL; - pl_python_get_py_program_name (&prog_name); - bool pdm_exist = false, poetry_exist = false; pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); - if (prog_name) - { - pl_python_pip_setsrc (option); - say (""); - } - - if (poetry_exist) - { - pl_python_poetry_setsrc (option); - say (""); - } - - if (pdm_exist) - { - pl_python_pdm_setsrc (option); - } -} - - -void -pl_python_setsrc (char *option) -{ - char *chsrc_type = xy_streql (option, ChsrcTypeReset) ? ChsrcTypeReset : ChsrcTypeAuto; - - char *prog_name = NULL; - pl_python_get_py_program_name (&prog_name); - - bool pdm_exist = false, - poetry_exist = false; - - pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); - - // chsrc_yield_source_and_confirm (pl_python); - - if (prog_name) - { - pl_python_pip_getsrc (option); - say (""); - } + // 交给后面检查命令的存在性 + pl_python_pip_getsrc (option); + say (""); if (poetry_exist) { @@ -92,6 +53,35 @@ pl_python_setsrc (char *option) { pl_python_pdm_getsrc (option); } +} + + +void +pl_python_setsrc (char *option) +{ + char *chsrc_type = xy_streql (option, ChsrcTypeReset) ? ChsrcTypeReset : ChsrcTypeAuto; + + bool pdm_exist = false, + poetry_exist = false; + + pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); + + // chsrc_yield_source_and_confirm (pl_python); + + // 交给后面检查命令的存在性 + pl_python_pip_setsrc (option); + say (""); + + if (poetry_exist) + { + pl_python_poetry_setsrc (option); + say (""); + } + + if (pdm_exist) + { + pl_python_pdm_setsrc (option); + } // chsrc_conclude (&source, chsrc_type); } diff --git a/src/recipe/lang/Python/pip.c b/src/recipe/lang/Python/pip.c index a85068a..ff77b40 100644 --- a/src/recipe/lang/Python/pip.c +++ b/src/recipe/lang/Python/pip.c @@ -50,6 +50,15 @@ pl_python_pip_getsrc (char *option) void pl_python_pip_setsrc (char *option) { + // 对于不支持的情况,尽早结束 + if (CliOpt_Locally) + { + char *msg = CliOpt_InEnglish ? "pip doesn't support `-local`. SKIP changing source!" : "pip 不支持 -local,跳过换源"; + chsrc_error (msg); + // 不能直接退出,因为 Leader target 不能就此结束 + return; + } + chsrc_yield_source_and_confirm (pl_python_pip); char *py_prog_name = NULL;