Add Rye config via rawstr4c

This commit is contained in:
Aoran Zeng 2025-07-22 18:42:28 +08:00
parent 6b883db9ac
commit 86e0165733
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 28 additions and 16 deletions

View File

@ -4,7 +4,7 @@
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-12-06>
* Last Modified : <2025-07-21>
* Last Modified : <2025-07-22>
*
* Rye已经有后继uv了Python group中
* ------------------------------------------------------------*/
@ -38,22 +38,17 @@ pl_python_rye_getsrc (char *option)
void
pl_python_rye_setsrc (char *option)
{
/* 并不在 Python group 中,所以不考虑 target group 情况 */
/* 并不在 Python group 中,所以不考虑 target group 情况,仅使用 Python group 提供的源 */
chsrc_yield_source_and_confirm (pl_python_group);
const char *file =
R"(
[[sources]]
name = "@1@"
url = "@2@"
)";
const char *content = RAWSTR_pl_python_rye_config;
file = xy_str_gsub (file, "@1@", source.mirror->abbr);
file = xy_str_gsub (file, "@2@", source.url);
content = xy_str_gsub (content, "@1@", source.mirror->abbr);
content = xy_str_gsub (content, "@2@", source.url);
char *rye_config = pl_python_find_rye_config ();
chsrc_note2 (xy_strjoin (3, "请在配置文件 ", rye_config, " 中添加:"));
println (file);
print (content);
chsrc_determine_chgtype (ChgType_Manual);
chsrc_conclude (&source);

View File

@ -1,9 +1,7 @@
#pragma once
/**
* Generated by rawstr4c v0.2.1.0-2025/07/16
*
* Date: 2025-07-16T23:55:50.053226+08:00
* Generated by rawstr4c v0.2.3-2025/07/22
*/
char RAWSTR_pl_python_uv_config_source_content[] = "\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x0a\x75\x72\x6c\x20\x3d\x20\x22\x40\x75\x72\x6c\x22\x0a\x64\x65\x66\x61\x75\x6c\x74\x20\x3d\x20\x74\x72\x75\x65\x0a\x0a";
@ -14,3 +12,5 @@ char RAWSTR_pl_python_set_uv_config[] = "\x40\x73\x65\x64\x40\x20\x27\x2f\x5e\x5
char RAWSTR_pl_python_final_uv_cmd[] = "\x67\x72\x65\x70\x20\x2d\x71\x20\x27\x5e\x5b\x5b\x69\x6e\x64\x65\x78\x5d\x5d\x24\x27\x20\x40\x66\x40\x20\x26\x26\x20\x40\x75\x63\x6d\x64\x40\x20\x7c\x7c\x20\x40\x61\x63\x6d\x64\x40\x0a";
char RAWSTR_pl_python_rye_config[] = "\x5b\x5b\x73\x6f\x75\x72\x63\x65\x73\x5d\x5d\x0a\x6e\x61\x6d\x65\x20\x3d\x20\x22\x40\x31\x40\x22\x0a\x75\x72\x6c\x20\x20\x3d\x20\x22\x40\x32\x40\x22\x0a";

View File

@ -6,7 +6,7 @@
! | happy game <happygame1024@gmail.com>
! Contributors : Nil Null <nil@null.org>
! Created On : <2025-07-14>
! Last Modified : <2025-07-14>
! Last Modified : <2025-07-22>
! ---------------------------------------------------------- -->
# rawstr4c input for Python
@ -16,8 +16,12 @@
- translate = `:hex`
- keep-postfix = `false`
<br>
## uv
### uv config source content
```toml
@ -42,9 +46,22 @@ grep -A 2 'index' @f@ | sed -n 's/^url = "\(.*\)"/\1/p'
```
### Final uv cmd
```sh
grep -q '^[[index]]$' @f@ && @ucmd@ || @acmd@
```
<br>
## Rye
- name = `rye_config`
```toml
[[sources]]
name = "@1@"
url = "@2@"
```