Update pl recipes using chef DSL

This commit is contained in:
Aoran Zeng
2025-08-10 18:33:28 +08:00
parent caa90fee32
commit 616b0caa48
15 changed files with 449 additions and 551 deletions

View File

@@ -1,15 +1,38 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2024-06-05>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get pdm
*/
def_target(pl_python_pdm);
void
pl_python_pdm_prelude (void)
{
use_this(pl_python_pdm);
chef_set_created_on (this, "2024-06-05");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
void
pl_python_pdm_getsrc (char *option)
{
@@ -22,8 +45,6 @@ pl_python_pdm_getsrc (char *option)
/**
* @consult https://github.com/RubyMetric/chsrc/issues/19
*
* chsrc set pdm
*/
void
pl_python_pdm_setsrc (char *option)
@@ -48,38 +69,8 @@ pl_python_pdm_setsrc (char *option)
}
}
/**
* chsrc reset pdm
*/
void
pl_python_pdm_resetsrc (char *option)
{
pl_python_pdm_setsrc (option);
}
/**
* chsrc ls pdm
*/
Feature_t
pl_python_pdm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
// PDM 完全支持项目级换源
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_pdm);
Target_t pl_python_pdm_target = {def_target_inner_gsrf(pl_python_pdm),def_target_sourcesn(pl_python_group)};

View File

@@ -1,17 +1,37 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nil Null <nil@null.org>
* Created On : <2024-08-08>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
// @note Poetry 默认使用项目级换源
def_target(pl_python_poetry);
void
pl_python_poetry_prelude (void)
{
use_this(pl_python_poetry);
chef_set_created_on (this, "2024-08-08");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nil Null", "nil@null.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "Poetry 默认使用项目级换源", "Poetry uses project-level source changing by default");
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
/**
* chsrc get poetry
*/
void
pl_python_poetry_getsrc (char *option)
{
@@ -21,8 +41,6 @@ pl_python_poetry_getsrc (char *option)
/**
* @consult https://python-poetry.org/docs/repositories/#project-configuration
*
* chsrc set poetry
*/
void
pl_python_poetry_setsrc (char *option)
@@ -47,35 +65,8 @@ pl_python_poetry_setsrc (char *option)
}
/**
* chsrc reset poetry
*/
void
pl_python_poetry_resetsrc (char *option)
{
pl_python_poetry_setsrc (option);
}
/**
* chsrc ls poetry
*/
Feature_t
pl_python_poetry_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = NULL;
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_poetry);
Target_t pl_python_poetry_target = {def_target_inner_gsrf(pl_python_poetry),def_target_sourcesn(pl_python_group)};

View File

@@ -6,7 +6,6 @@
* |
* Created On : <2023-09-03>
* Last Modified : <2025-07-14>
*
* ------------------------------------------------------------*/
void
@@ -85,27 +84,9 @@ pl_python_group_setsrc (char *option)
chsrc_conclude (&source);
}
void
pl_python_group_resetsrc (char *option)
{
pl_python_group_setsrc (option);
}
Feature_t
pl_python_group_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = PartiallyCan;
f.cap_locally_explain = "Support Poetry, PDM, uv. No support for pip";
f.can_english = false;
f.can_user_define = true;
return f;
}
def_target_gsrf(pl_python_group);

View File

@@ -1,14 +1,40 @@
/** ------------------------------------------------------------
* 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 : <2025-08-09>
*
* 由于Rye已经有后继uv了所以我们不把该管理器纳入Python group中
* ------------------------------------------------------------*/
def_target(pl_python_rye);
void
pl_python_rye_prelude (void)
{
use_this(pl_python_rye);
chef_set_created_on (this, "2024-12-06");
chef_set_last_updated (this, "2025-08-09");
chef_set_sources_last_updated (this, "2025-08-09");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
chef_set_note ("由于Rye已经有后继uv了所以我们不把该管理器纳入Python group中",
"Since Rye has successor uv, we don't include this manager in Python group");
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
char *
pl_python_find_rye_config ()
{
@@ -18,9 +44,8 @@ pl_python_find_rye_config ()
return rye_config;
}
/**
* chsrc get rye
*/
void
pl_python_rye_getsrc (char *option)
{
@@ -31,9 +56,6 @@ pl_python_rye_getsrc (char *option)
/**
* @consult https://github.com/RubyMetric/chsrc/issues/127
* @consult recipe Java
*
* chsrc set rye
*/
void
pl_python_rye_setsrc (char *option)
@@ -55,36 +77,8 @@ pl_python_rye_setsrc (char *option)
}
/**
* 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_group)};

View File

@@ -1,80 +1,73 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : yongxiang <1926885268@qq.com>
* | happy game <happygame1024@gmail.com>
* |
* Created On : <2023-09-03>
* Major Revision : 1
* Last Modified : <2025-07-14>
* ------------------------------------------------------------*/
#include "rawstr4c.h"
#include "rawstr4c.h"
def_target(pl_python_group);
/**
* 注意这个前缀是 host/pipi/web/pacakges....
* @note 测速链接的这个前缀是 ${host}/pipi/web/pacakges/56/e4....
* 下面有几个镜像站微调了这个路径,我们只要确认能找到 packages 目录就好
*/
#define PL_Python_Group_Speed_URL_Postfix "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
static SourceProvider_t pl_python_pypi_upstream =
static char *
pl_python_speed_url_constructor (char *url, char *user_data)
{
def_upstream, "https://pypi.org/",
{NotSkip, NA, NA, "https://files.pythonhosted.org/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", ACCURATE} // 260MB
};
char *str = xy_str_delete_suffix ("/simple");
str = xy_2strjoin (str, "/packages/56/e4/55aaac2b15af4dad079e5af329a79d961e5206589d0e02b1e8da221472ed/tensorflow-2.18.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl");
return str;
}
/**
* @update 2025-07-11
* @note 不要添加Zju浙大的PyPI服务在校外访问会自动转向Tuna
*/
static Source_t pl_python_group_sources[] =
void
pl_python_group_prelude (void)
{
{&pl_python_pypi_upstream, "https://pypi.org/simple", DelegateToUpstream},
use_this(pl_python_group);
{&MirrorZ, "https://mirrors.cernet.edu.cn/pypi/web/simple",
"https://mirrors.cernet.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
chef_set_created_on (this, "2023-09-03");
chef_set_last_updated (this, "2025-07-14");
chef_set_sources_last_updated (this, "2025-07-11");
{&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple",
"https://mirrors.bfsu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 2,
"yongxiang", "1926885268@qq.com",
"happy game", "happygame1024@gmail.com");
{&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple",
"https://mirror.lzu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
chef_allow_get();
chef_allow_set();
chef_allow_reset();
{&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple",
"https://mirrors.jlu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
chef_allow_english(this);
chef_allow_user_define(this);
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple",
"https://mirror.sjtu.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple",
"https://pypi.tuna.tsinghua.edu.cn" PL_Python_Group_Speed_URL_Postfix},
def_sources_begin()
{&upstream, "https://pypi.org/simple", FeedByPrelude},
{&MirrorZ, "https://mirrors.cernet.edu.cn/pypi/web/simple",FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/pypi/web/simple", FeedByPrelude},
/* 不要添加Zju浙大的PyPI服务在校外访问会自动转向Tuna */
{&Lzuoss, "https://mirror.lzu.edu.cn/pypi/web/simple",FeedByPrelude},
{&Jlu, "https://mirrors.jlu.edu.cn/pypi/web/simple",FeedByPrelude},
{&Sjtug_Zhiyuan, "https://mirror.sjtu.edu.cn/pypi/web/simple",FeedByPrelude,
{&Tuna, "https://pypi.tuna.tsinghua.edu.cn/simple", FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/pypi/simple/", FeedByPrelude},
{&Nju, "https://mirror.nju.edu.cn/pypi/web/simple",FeedByPrelude},
{&Pku, "https://mirrors.pku.edu.cn/pypi/web/simple",FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple",FeedByPrelude},
{&Ali, "https://mirrors.aliyun.com/pypi/simple/",
"https://mirrors.aliyun.com/pypi" PL_Python_Group_Speed_URL_Postfix},
{&Nju, "https://mirror.nju.edu.cn/pypi/web/simple",
"https://mirror.nju.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Pku, "https://mirrors.pku.edu.cn/pypi/web/simple",
"https://mirrors.pku.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/pypi/simple",
"https://mirrors.cloud.tencent.com/pypi" PL_Python_Group_Speed_URL_Postfix},
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple",
// "https://mirrors.cloud.tencentyun.com/pypi" PL_Python_Group_Speed_URL_Postfix,
{&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple",
"https://mirrors.huaweicloud.com/repository/pypi" PL_Python_Group_Speed_URL_Postfix},
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple",
"https://mirrors.hust.edu.cn/pypi/web" PL_Python_Group_Speed_URL_Postfix},
// {&Tencent_Intra, "https://mirrors.cloud.tencentyun.com/pypi/simple",FeedByPrelude}
{&Huawei, "https://mirrors.huaweicloud.com/repository/pypi/simple",FeedByPrelude},
{&Hust, "https://mirrors.hust.edu.cn/pypi/web/simple",FeedByPrelude}
/* 不启用原因24小时更新一次 */
// {&Netease, "https://mirrors.163.com/.help/pypi.html", NULL}
};
def_sources_n(pl_python_group);
def_sources_end()
chsrc_set_sources_speed_measure_url_with_func (this, pl_python_speed_url_constructor, NULL);
}
void
pl_python_check_unofficial_pkger (bool *poetry_exist, bool *pdm_exist, bool *uv_exist)

View File

@@ -1,15 +1,38 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Nul None <nul@none.org>
* Created On : <2023-09-03>
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get pip
*/
def_target(pl_python_pip);
void
pl_python_pip_prelude (void)
{
use_this(pl_python_pip);
chef_set_created_on (this, "2023-09-03");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
chef_set_authors (this, 1, "Aoran Zeng", "ccmywish@qq.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 1,
"Nul None", "nul@none.org");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_forbid_local_mode (this);
chef_allow_english(this);
chef_allow_user_define(this);
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
void
pl_python_pip_getsrc (char *option)
{
@@ -23,8 +46,6 @@ pl_python_pip_getsrc (char *option)
/**
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/pypi/
*
* chsrc set pip
*/
void
pl_python_pip_setsrc (char *option)
@@ -59,36 +80,8 @@ pl_python_pip_setsrc (char *option)
}
/**
* chsrc reset pip
*/
void
pl_python_pip_resetsrc (char *option)
{
pl_python_pip_setsrc (option);
}
/**
* chsrc ls pip
*/
Feature_t
pl_python_pip_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
// pip 不支持项目级换源
f.cap_locally = CanNot;
f.cap_locally_explain = NULL;
f.can_english = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_python_pip);
Target_t pl_python_pip_target = {def_target_inner_gsrf(pl_python_pip),def_target_sourcesn(pl_python_group)};

View File

@@ -1,15 +1,41 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : happy game <happygame1024@gmail.com>
* Contributors : ccy <icuichengyi@gmail.com>
* | Aoran Zeng <ccmywish@qq.com>
* |
* Created On : <2024-12-11>
* Major Revision : 1
* Last Modified : <2025-08-09>
* ------------------------------------------------------------*/
def_target(pl_python_uv);
void
pl_python_uv_prelude (void)
{
use_this(pl_python_uv);
chef_set_created_on (this, "2024-12-11");
chef_set_last_updated (this, "2025-08-09");
chef_set_sources_last_updated (this, "2025-08-09");
chef_set_authors (this, 1, "happy game", "happygame1024@gmail.com");
chef_set_chef (this, NULL, NULL);
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 2,
"ccy", "icuichengyi@gmail.com",
"Aoran Zeng", "ccmywish@qq.com");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_english(this);
chef_allow_user_define(this);
chef_set_note ("uv的配置优先级顺序: $workspaces/uv.toml > $workspaces/pyproject.toml > ~/.config/uv/uv.toml > /etc/uv/uv.toml",
"uv config priority order: $workspaces/uv.toml > $workspaces/pyproject.toml > ~/.config/uv/uv.toml > /etc/uv/uv.toml");
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
/**
* chsrc get uv
*
@@ -84,8 +110,6 @@ pl_python_uv_getsrc (char *option)
/**
* @consult https://docs.astral.sh/uv/configuration/files/
* https://github.com/RubyMetric/chsrc/issues/139
*
* chsrc set uv
*/
void
pl_python_uv_setsrc (char *option)
@@ -148,36 +172,8 @@ pl_python_uv_setsrc (char *option)
}
/**
* chsrc reset uv
*/
void
pl_python_uv_resetsrc (char *option)
{
pl_python_uv_setsrc (option);
}
/**
* chsrc ls uv
*/
Feature_t
pl_python_uv_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_uv);
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python_group)};