diff --git a/src/recipe/lang/Python/Python.c b/src/recipe/lang/Python/Python.c index c1617a8..3bc58b3 100644 --- a/src/recipe/lang/Python/Python.c +++ b/src/recipe/lang/Python/Python.c @@ -2,20 +2,21 @@ * SPDX-License-Identifier: GPL-3.0-or-later * ------------------------------------------------------------- * File Authors : Aoran Zeng - * Contributors : Nil Null + * Contributors : happy game + * | * Created On : <2023-09-03> - * Last Modified : <2024-11-08> + * Last Modified : <2024-12-11> * - * 2024-08-08: uv 似乎暂时没有实现换源 * ------------------------------------------------------------*/ void pl_python_getsrc (char *option) { 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); @@ -31,6 +32,11 @@ pl_python_getsrc (char *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: " \ "pip, Poetry, PDM. If you need to change the source independently, " \ "please run independently `chsrc set `" - : "将同时为您更换3个包管理器 pip, Poetry, PDM 的源,若需要独立换源,请独立运行 chsrc set "; + : "将同时为您更换4个包管理器 pip, Poetry, PDM, uv 的源,若需要独立换源,请独立运行 chsrc set "; chsrc_note2 (msg); } 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; chsrc_yield_source_and_confirm (pl_python); @@ -68,6 +75,11 @@ pl_python_setsrc (char *option) { pl_python_pdm_setsrc (option); } + + if (uv_exist) + { + pl_python_uv_setsrc (option); + } ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto; chsrc_conclude (&source); @@ -89,7 +101,7 @@ pl_python_feat (char *option) f.can_reset = true; 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_user_define = true; diff --git a/src/recipe/lang/Python/common.h b/src/recipe/lang/Python/common.h index 8714e84..7d87835 100644 --- a/src/recipe/lang/Python/common.h +++ b/src/recipe/lang/Python/common.h @@ -3,10 +3,10 @@ * ------------------------------------------------------------- * File Authors : Aoran Zeng * Contributors : yongxiang <1926885268@qq.com> - * | + * | happy game * Created On : <2023-09-03> * Major Revision : 1 - * Last Modified : <2024-12-08> + * Last Modified : <2024-12-11> * ------------------------------------------------------------*/ static SourceProvider_t UpstreamPython = @@ -39,10 +39,11 @@ static Source_t pl_python_sources[] = def_sources_n(pl_python); 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"); *pdm_exist = chsrc_check_program ("pdm"); + *uv_exist = chsrc_check_program ("uv"); }