mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-30 16:42:46 +08:00
parent
2e33ef697e
commit
ca1dd97a52
@ -654,9 +654,9 @@ main (int argc, char const *argv[])
|
|||||||
|
|
||||||
if (CliOpt_DryRun)
|
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). " \
|
"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";
|
: "**开启Dry Run模式,模拟换源过程(跳过测速),命令仅打印并不运行**\n";
|
||||||
chsrc_log (bdyellow(dry_msg));
|
chsrc_log (bdyellow(dry_msg));
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,10 @@ void
|
|||||||
pl_nodejs_setsrc (char *option)
|
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, " \
|
"npm, pnpm, yarn. If you need to change the source independently, " \
|
||||||
"please run independently `chsrc set <pkg-manager>` **\n"
|
"please run independently `chsrc set <pkg-manager>`**\n"
|
||||||
: "** 将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager> **\n";
|
: "**将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>**\n";
|
||||||
chsrc_log (bdyellow(msg));
|
chsrc_log (bdyellow(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,30 +4,9 @@
|
|||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Contributors : Nul None <nul@none.org>
|
* Contributors : Nul None <nul@none.org>
|
||||||
* Created On : <2024-06-05>
|
* 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
|
* chsrc get pdm
|
||||||
*/
|
*/
|
||||||
@ -49,7 +28,10 @@ pl_python_pdm_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_pdm_setsrc (char *option)
|
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;
|
char *cmd = NULL;
|
||||||
|
|
||||||
@ -96,4 +78,5 @@ pl_python_pdm_feat (char *option)
|
|||||||
return fi;
|
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)};
|
||||||
|
@ -4,33 +4,11 @@
|
|||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Contributors : Nil Null <nil@null.org>
|
* Contributors : Nil Null <nil@null.org>
|
||||||
* Created On : <2024-08-08>
|
* Created On : <2024-08-08>
|
||||||
* Last Modified : <2024-09-13>
|
* Last Modified : <2024-09-14>
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
// @note Poetry 默认使用项目级换源
|
// @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
|
* chsrc get poetry
|
||||||
*/
|
*/
|
||||||
@ -49,7 +27,10 @@ pl_python_poetry_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_poetry_setsrc (char *option)
|
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;
|
char *cmd = NULL;
|
||||||
|
|
||||||
@ -93,4 +74,5 @@ pl_python_poetry_feat (char *option)
|
|||||||
return fi;
|
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)};
|
||||||
|
@ -9,28 +9,6 @@
|
|||||||
* 2024-08-08: uv 似乎暂时没有实现换源
|
* 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
|
void
|
||||||
pl_python_getsrc (char *option)
|
pl_python_getsrc (char *option)
|
||||||
{
|
{
|
||||||
@ -59,6 +37,14 @@ pl_python_getsrc (char *option)
|
|||||||
void
|
void
|
||||||
pl_python_setsrc (char *option)
|
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 <pkg-manager>`**\n"
|
||||||
|
: "**将同时为您更换3个包管理器 pip, Poetry, PDM 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>**\n";
|
||||||
|
chsrc_log (bdyellow(msg));
|
||||||
|
}
|
||||||
|
|
||||||
char *chsrc_type = xy_streql (option, ChsrcTypeReset) ? ChsrcTypeReset : ChsrcTypeAuto;
|
char *chsrc_type = xy_streql (option, ChsrcTypeReset) ? ChsrcTypeReset : ChsrcTypeAuto;
|
||||||
|
|
||||||
bool pdm_exist = false,
|
bool pdm_exist = false,
|
||||||
@ -66,7 +52,9 @@ pl_python_setsrc (char *option)
|
|||||||
|
|
||||||
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist);
|
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);
|
pl_python_pip_setsrc (option);
|
||||||
|
@ -8,6 +8,26 @@
|
|||||||
* Last Modified : <2024-09-13>
|
* 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
|
void
|
||||||
pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist)
|
pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist)
|
||||||
{
|
{
|
||||||
|
@ -4,30 +4,9 @@
|
|||||||
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
* File Authors : Aoran Zeng <ccmywish@qq.com>
|
||||||
* Contributors : Nul None <nul@none.org>
|
* Contributors : Nul None <nul@none.org>
|
||||||
* Created On : <2023-09-03>
|
* 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
|
* chsrc get pip
|
||||||
*/
|
*/
|
||||||
@ -59,7 +38,10 @@ pl_python_pip_setsrc (char *option)
|
|||||||
return;
|
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;
|
char *py_prog_name = NULL;
|
||||||
pl_python_get_py_program_name (&py_prog_name);
|
pl_python_get_py_program_name (&py_prog_name);
|
||||||
@ -105,4 +87,5 @@ pl_python_pip_feat (char *option)
|
|||||||
return fi;
|
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)};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user