Support Rye for Python

[GitHub #127]
This commit is contained in:
Aoran Zeng 2024-12-06 10:56:38 +08:00
parent 3e62f2aa85
commit 5ec75b379a
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 98 additions and 6 deletions

View File

@ -17,14 +17,15 @@
* | GnixAij <gaojiaxing0220@gmail.com>
* | ChatGPT <https://chatgpt.com>
* | czyt <czyt.go@gmail.com>
* | zouri <guoshuaisun@outlook.com>
* |
* Created On : <2023-08-28>
* Last Modified : <2024-11-22>
* Last Modified : <2024-12-06>
*
* chsrc: Change Source
* ------------------------------------------------------------*/
#define Chsrc_Version "0.1.9.4"
#define Chsrc_Version "0.1.9.4-dev1"
#define Chsrc_Release_Date "2024/11/22"
#define Chsrc_Banner_Version "v" Chsrc_Version "-" Chsrc_Release_Date
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
@ -38,6 +39,7 @@
#include "recipe/lang/Python/pip.c"
#include "recipe/lang/Python/Poetry.c"
#include "recipe/lang/Python/PDM.c"
#include "recipe/lang/Python/Rye.c"
#include "recipe/lang/Python/Python.c"
#include "recipe/lang/Node.js/common.h"

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-06-05>
* Last Modified : <2024-09-14>
* ------------------------------------------------------------*/

View File

@ -0,0 +1,89 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-12-06>
* Last Modified : <2024-12-06>
*
* Rye已经有后继uv了Python group中
* ------------------------------------------------------------*/
char *
pl_python_find_rye_config ()
{
char *buf = xy_run ("rye config --show-path", 0, NULL);
char *rye_config = xy_normalize_path (xy_str_strip (buf));
return rye_config;
}
/**
* chsrc get rye
*/
void
pl_python_rye_getsrc (char *option)
{
char *rye_config = pl_python_find_rye_config ();
chsrc_note2 (xy_strjoin (3, "请查看 ", rye_config, " 配置文件中的 [[sources]] 节内容"));
}
/**
* @consult https://github.com/RubyMetric/chsrc/issues/127
* @consult recipe Java
*
* chsrc set rye
*/
void
pl_python_rye_setsrc (char *option)
{
chsrc_yield_source_and_confirm (pl_python);
const char *file = xy_strjoin (7,
"[[sources]]\n",
"name = \"", source.mirror->abbr, "\"\n",
"url = \"", source.url, "\"");
char *rye_config = pl_python_find_rye_config ();
chsrc_note2 (xy_strjoin (3, "请在您的 Rye 配置文件 ", rye_config, " 中添加:"));
puts (file);
ProgMode_ChgType = ChgType_Manual;
chsrc_conclude (&source);
}
/**
* chsrc reset rye
*/
void
pl_python_rye_resetsrc (char *option)
{
pl_python_rye_setsrc (option);
}
/**
* chsrc ls rye
*/
Feature_t
pl_python_rye_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = true;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_rye);
Target_t pl_python_rye_target = {def_target_inner_gsrf(pl_python_rye),def_target_sourcesn(pl_python)};

View File

@ -2,7 +2,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Contributors : Nul None <nul@none.org>
* Created On : <2023-09-03>
* Last Modified : <2024-09-14>
* ------------------------------------------------------------*/

View File

@ -5,7 +5,7 @@
* Contributors : Nil Null <nil@null.org>
* Created On : <2023-09-01>
* Major Revision : 1
* Last Modified : <2024-10-29>
* Last Modified : <2024-12-06>
* ------------------------------------------------------------*/
/* Begin Target Matrix */
@ -17,6 +17,7 @@ static const char
*pl_python_pip[] = {"pip", NULL, t(&pl_python_pip_target)},
*pl_python_poetry[] = {"poetry", NULL, t(&pl_python_poetry_target)},
*pl_python_pdm[] = {"pdm", NULL, t(&pl_python_pdm_target)},
*pl_python_rye[] = {"rye", NULL, t(&pl_python_rye_target)},
*pl_nodejs[] = {"node", "nodejs", NULL, t(&pl_nodejs_target)},
*pl_nodejs_bun[] = {"bun", NULL, t(&pl_nodejs_bun_target)},
@ -47,7 +48,7 @@ static const char
**pl_packagers[] =
{
pl_ruby,
pl_python, pl_python_pip, pl_python_poetry, pl_python_pdm,
pl_python, pl_python_pip, pl_python_poetry, pl_python_pdm, pl_python_rye,
pl_nodejs, pl_nodejs_bun,
pl_nodejs_npm, pl_nodejs_pnpm, pl_nodejs_yarn,
pl_nodejs_nvm,