Only measure once when in group for Python

[GitHub #79]
This commit is contained in:
Aoran Zeng
2024-09-14 01:39:51 +08:00
parent 2e33ef697e
commit ca1dd97a52
7 changed files with 57 additions and 101 deletions

View File

@@ -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 <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;
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);