mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-08 19:54:13 +08:00
parent
48cefa1b1d
commit
7901491c39
@ -341,7 +341,7 @@ query_mirror_exist (SourceInfo *sources, size_t size, char *target, char *input)
|
|||||||
|
|
||||||
if (xy_streql ("first", 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);
|
say (msg);
|
||||||
return 1; // 返回第2个,因为第1个是上游默认源
|
return 1; // 返回第2个,因为第1个是上游默认源
|
||||||
}
|
}
|
||||||
|
@ -34,53 +34,14 @@ def_sources_n(pl_python);
|
|||||||
void
|
void
|
||||||
pl_python_getsrc (char *option)
|
pl_python_getsrc (char *option)
|
||||||
{
|
{
|
||||||
char *prog_name = NULL;
|
|
||||||
pl_python_get_py_program_name (&prog_name);
|
|
||||||
|
|
||||||
bool pdm_exist = false,
|
bool pdm_exist = false,
|
||||||
poetry_exist = false;
|
poetry_exist = false;
|
||||||
|
|
||||||
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist);
|
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);
|
pl_python_pip_getsrc (option);
|
||||||
say ("");
|
say ("");
|
||||||
}
|
|
||||||
|
|
||||||
if (poetry_exist)
|
if (poetry_exist)
|
||||||
{
|
{
|
||||||
@ -92,6 +53,35 @@ pl_python_setsrc (char *option)
|
|||||||
{
|
{
|
||||||
pl_python_pdm_getsrc (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);
|
// chsrc_conclude (&source, chsrc_type);
|
||||||
}
|
}
|
||||||
|
@ -50,6 +50,15 @@ pl_python_pip_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_pip_setsrc (char *option)
|
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);
|
chsrc_yield_source_and_confirm (pl_python_pip);
|
||||||
|
|
||||||
char *py_prog_name = NULL;
|
char *py_prog_name = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user