Add uv to Python group

This commit is contained in:
happy game 2024-12-11 14:40:16 +08:00
parent 90ecd7f5ed
commit 7c8d64adbc
2 changed files with 25 additions and 12 deletions

View File

@ -2,20 +2,21 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org> * Contributors : happy game <happygame1024@gmail.com>
* |
* Created On : <2023-09-03> * Created On : <2023-09-03>
* Last Modified : <2024-11-08> * Last Modified : <2024-12-11>
* *
* 2024-08-08: uv
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
void void
pl_python_getsrc (char *option) pl_python_getsrc (char *option)
{ {
bool pdm_exist = false, bool pdm_exist = false,
poetry_exist = false; poetry_exist = false,
uv_exist = false;
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist);
// 交给后面检查命令的存在性 // 交给后面检查命令的存在性
pl_python_pip_getsrc (option); pl_python_pip_getsrc (option);
@ -31,6 +32,11 @@ pl_python_getsrc (char *option)
{ {
pl_python_pdm_getsrc (option); pl_python_pdm_getsrc (option);
} }
if (uv_exist)
{
pl_python_uv_getsrc (option);
}
} }
@ -41,14 +47,15 @@ pl_python_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: " \
"pip, Poetry, PDM. If you need to change the source independently, " \ "pip, Poetry, PDM. If you need to change the source independently, " \
"please run independently `chsrc set <pkg-manager>`" "please run independently `chsrc set <pkg-manager>`"
: "将同时为您更换3个包管理器 pip, Poetry, PDM 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>"; : "将同时为您更换4个包管理器 pip, Poetry, PDM, uv 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>";
chsrc_note2 (msg); chsrc_note2 (msg);
} }
bool pdm_exist = false, bool pdm_exist = false,
poetry_exist = false; poetry_exist = false,
uv_exist = false;
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist); pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist);
ProgMode_Target_Group = true; ProgMode_Target_Group = true;
chsrc_yield_source_and_confirm (pl_python); chsrc_yield_source_and_confirm (pl_python);
@ -68,6 +75,11 @@ pl_python_setsrc (char *option)
{ {
pl_python_pdm_setsrc (option); pl_python_pdm_setsrc (option);
} }
if (uv_exist)
{
pl_python_uv_setsrc (option);
}
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
chsrc_conclude (&source); chsrc_conclude (&source);
@ -89,7 +101,7 @@ pl_python_feat (char *option)
f.can_reset = true; f.can_reset = true;
f.cap_locally = PartiallyCan; f.cap_locally = PartiallyCan;
f.cap_locally_explain = "Support `Poetry` & `PDM`. No support for `pip`"; f.cap_locally_explain = "Support `Poetry` & `PDM`, `uv`. No support for `pip`";
f.can_english = false; f.can_english = false;
f.can_user_define = true; f.can_user_define = true;

View File

@ -3,10 +3,10 @@
* ------------------------------------------------------------- * -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com> * File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : yongxiang <1926885268@qq.com> * Contributors : yongxiang <1926885268@qq.com>
* | * | happy game <happygame1024@gmail.com>
* Created On : <2023-09-03> * Created On : <2023-09-03>
* Major Revision : 1 * Major Revision : 1
* Last Modified : <2024-12-08> * Last Modified : <2024-12-11>
* ------------------------------------------------------------*/ * ------------------------------------------------------------*/
static SourceProvider_t UpstreamPython = static SourceProvider_t UpstreamPython =
@ -39,10 +39,11 @@ static Source_t pl_python_sources[] =
def_sources_n(pl_python); 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, bool *uv_exist)
{ {
*poetry_exist = chsrc_check_program ("poetry"); *poetry_exist = chsrc_check_program ("poetry");
*pdm_exist = chsrc_check_program ("pdm"); *pdm_exist = chsrc_check_program ("pdm");
*uv_exist = chsrc_check_program ("uv");
} }