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
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
15 changed files with 449 additions and 551 deletions

View File

@ -1088,18 +1088,20 @@ chsrc_set_provider_speed_measure_accuracy (SourceProvider_t *provider, bool accu
}
/**
* @brief
* @brief "换源 URL"
*/
static void
chsrc_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix)
chsrc_set_sources_speed_measure_url_with_func (
Target_t *target,
SpeedUrlConstructor_t func,
char *user_data)
{
Source_t *sources = &target->sources;
for (int i=0; i<n; i++)
{
Source_t *src = &sources[i];
ProviderType_t type = src->provider->type;
if (IS_DedicatedMirrorSite==type)
@ -1112,13 +1114,27 @@ chsrc_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfi
{
/* 为空时才修改 或者里面是脏数据 */
if (NULL==src->speed_measure_url || !chef_is_url (src->speed_measure_url))
src->speed_measure_url = xy_2strjoin (src->url, postfix);
{
src->speed_measure_url = func (src->url, postfix);
}
}
}
}
/**
* @brief "换源 URL"
*/
static void
chsrc_set_sources_speed_measure_url_with_postfix (Target_t *target, char *postfix)
{
xy_2strjoin (src->url, postfix);
chsrc_set_sources_speed_measure_url_with_func (target, xy_2strjoin, postfix);
}
void
chsrc_determine_chgtype (ChgType_t type)

View File

@ -1,12 +1,37 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Lontten <lontten@163.com>
* Created On : <2024-09-29>
* Last Modified : <2025-07-22>
* ------------------------------------------------------------*/
def_target(pl_js_bun);
void
pl_js_bun_prelude (void)
{
use_this(pl_js_bun);
chef_set_created_on (this, "2024-09-29");
chef_set_last_updated (this, "2025-07-22");
chef_set_sources_last_updated (this, "2025-07-22");
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,
"Lontten", "lontten@163.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);
// 用的是 npm Registry 的源,所以使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
/**
* chsrc get bun
*/
@ -58,27 +83,3 @@ pl_js_bun_resetsrc (char *option)
{
pl_js_bun_setsrc (option);
}
/**
* chsrc ls bun
*/
Feature_t
pl_js_bun_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 = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_bun);
Target_t pl_js_bun_target = {def_target_inner_gsrf(pl_js_bun),def_target_sourcesn(pl_js_group)};

View File

@ -26,9 +26,6 @@ pl_js_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
}
/**
* chsrc get nodejs
*/
void
pl_js_group_getsrc (char *option)
{
@ -57,9 +54,6 @@ pl_js_group_getsrc (char *option)
}
/**
* chsrc set nodejs
*/
void
pl_js_group_setsrc (char *option)
{
@ -99,33 +93,8 @@ pl_js_group_setsrc (char *option)
}
/**
* chsrc reset nodejs
*/
void
pl_js_group_resetsrc (char *option)
{
pl_js_group_setsrc (option);
}
/**
* chsrc ls nodejs
*/
Feature_t
pl_js_group_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = true;
f.cap_locally = FullyCan;
f.cap_locally_explain = "Support `npm` & `yarn v2` & `pnpm`. No support for `yarn v1`";
f.can_english = true;
f.can_user_define = true;
return f;
}
def_target_gsrf (pl_js_group);

View File

@ -1,13 +1,37 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mr. Will <mr.will.com@outlook.com>
* Created On : <2023-09-09>
* Major Reviison : 3
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
def_target(pl_js_yarn);
void
pl_js_yarn_prelude (void)
{
use_this(pl_js_yarn);
chef_set_created_on (this, "2023-09-09");
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,
"Mr. Will", "mr.will.com@outlook.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);
// 使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
static double
pl_js_yarn_get_yarn_version ()
{
@ -17,9 +41,6 @@ pl_js_yarn_get_yarn_version ()
}
/**
* chsrc get yarn
*/
void
pl_js_yarn_getsrc (char *option)
{
@ -78,35 +99,8 @@ pl_js_yarn_setsrc (char *option)
}
/**
* chsrc reset yarn
*/
void
pl_js_yarn_resetsrc (char *option)
{
pl_js_yarn_setsrc (option);
}
/**
* chsrc ls yarn
*/
Feature_t
pl_js_yarn_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 = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_yarn);
Target_t pl_js_yarn_target = {def_target_inner_gsrf(pl_js_yarn),def_target_sourcesn(pl_js_group)};

View File

@ -1,86 +1,85 @@
/** ------------------------------------------------------------
* 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-09>
* Major Revision : 1
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
#define PL_JS_Group_Speed_URL_Postfix "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz"
static SourceProvider_t pl_js_npm_upstream =
{
def_upstream, "https://www.npmjs.com/",
{NotSkip, NA, NA, "https://registry.npmjs.org/@tensorflow/tfjs/-/tfjs-4.22.0.tgz", ACCURATE}
};
static MirrorSite_t NpmMirror =
{
IS_DedicatedMirrorSite,
"npmmirror", "npmmirror", "npmmirror (阿里云赞助)", "https://npmmirror.com/",
// 注意,下面这个是跳转后的地址,不确定未来会不会改变
{NotSkip, NA, NA, "https://cdn.npmmirror.com/packages/%40tensorflow/tfjs/4.22.0/tfjs-4.22.0.tgz", ACCURATE} // 29MB
{SKIP, NULL, NULL, NULL, ACCURATE}
};
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
* @note
* Sjtug, Tuna, Lzuoss, Jlu, Bfsu,
*/
static Source_t pl_js_group_sources[] =
def_target(pl_js_group);
void
pl_js_group_prelude (void)
{
{&pl_js_npm_upstream, "https://registry.npmjs.org/", DelegateToUpstream}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", DelegateToMirror},
use_this(pl_js_group);
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/",
"https://mirrors.huaweicloud.com/repository/npm/" PL_JS_Group_Speed_URL_Postfix},
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
{&Tencent, "https://mirrors.cloud.tencent.com/npm/",
"https://mirrors.cloud.tencent.com/npm/" PL_JS_Group_Speed_URL_Postfix},
};
def_sources_n(pl_js_group);
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,0);
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
chef_allow_english(this);
chef_allow_user_define(this);
def_sources_begin()
{&upstream, "https://registry.npmjs.org/", FeedByPrelude}, /* @note 根据 pnpm 官网,有最后的斜线 */
{&NpmMirror, "https://registry.npmmirror.com", FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/repository/npm/", FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/npm/", FeedByPrelude}
def_sources_end()
// 29MB 大小
chsrc_set_sources_speed_measure_url_with_postfix (this, "/@tensorflow/tfjs/-/tfjs-4.22.0.tgz");
}
#define PL_Nodejs_Binary_Speed_URL_Postfix "/v23.4.0/node-v23.4.0-linux-x64.tar.xz"
static SourceProvider_t pl_js_binary_release_upstream =
def_target(pl_js_binary_release);
void
pl_js_binary_release_prelude (void)
{
def_upstream, "https://nodejs.org/",
{NotSkip, NA, NA, "https://nodejs.org/dist/v23.4.0/node-v23.4.0.tar.gz", ACCURATE} // 100MB
};
use_this(pl_js_binary_release);
/**
* @update 2025-07-11
* @sync https://github.com/RubyMetric/chsrc/wiki/Node.js-BinaryRelease-MirrorSite
* @sync https://github.com/RubyMetric/chsrc/discussions/85
*
*/
static Source_t pl_js_binary_release_sources[] =
{
{&pl_js_binary_release_upstream, "https://nodejs.org/dist/", DelegateToUpstream},
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
chef_set_sources_last_updated (this, "2025-07-11");
{&NpmMirror, "https://npmmirror.com/mirrors",
"https://registry.npmmirror.com/-/binary/node/v23.4.0/node-v23.4.0.tar.gz"},
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");
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",
"https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
chef_allow_get();
chef_allow_set();
chef_allow_reset();
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",
"https://mirrors.bfsu.edu.cn/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix},
chef_forbid_local_mode (this);
chef_allow_english(this);
chef_allow_user_define(this);
{&Ustc, "https://mirrors.ustc.edu.cn/node/",
"https://mirrors.ustc.edu.cn/node/" PL_Nodejs_Binary_Speed_URL_Postfix},
def_sources_begin()
{&upstream, "https://nodejs.org/dist/", FeedByPrelude},
{&NpmMirror, "https://npmmirror.com/mirrors", FeedByPrelude},
{&Tuna, "https://mirrors.tuna.tsinghua.edu.cn/nodejs-release/",FeedByPrelude},
{&Bfsu, "https://mirrors.bfsu.edu.cn/nodejs-release/",FeedByPrelude},
{&Ustc, "https://mirrors.ustc.edu.cn/node/",FeedByPrelude},
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",FeedByPrelude},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/", FeedByPrelude}
def_sources_end()
{&Huawei, "https://mirrors.huaweicloud.com/nodejs/",
"https://mirrors.huaweicloud.com/nodejs/" PL_Nodejs_Binary_Speed_URL_Postfix},
{&Tencent, "https://mirrors.cloud.tencent.com/nodejs-release/",
"https://mirrors.cloud.tencent.com/nodejs-release/" PL_Nodejs_Binary_Speed_URL_Postfix}
};
def_sources_n(pl_js_binary_release);
chsrc_set_sources_speed_measure_url_with_postfix (this, "/v23.4.0/node-v23.4.0-linux-x64.tar.xz");
}

View File

@ -1,16 +1,38 @@
/** ------------------------------------------------------------
* SPDX-License-Identifier: GPL-3.0-or-later
* -------------------------------------------------------------
* File Authors : Aoran Zeng <ccmywish@qq.com>
* Contributors : Mr. Will <mr.will.com@outlook.com>
* Created On : <2023-08-30>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get npm
*/
def_target(pl_js_npm);
void
pl_js_npm_prelude (void)
{
use_this(pl_js_npm);
chef_set_created_on (this, "2023-08-30");
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,
"Mr. Will", "mr.will.com@outlook.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);
// 使用 pl_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
void
pl_js_npm_getsrc (char *option)
{
@ -20,8 +42,6 @@ pl_js_npm_getsrc (char *option)
/**
* @consult https://npmmirror.com/
*
* chsrc set npm
*/
void
pl_js_npm_setsrc (char *option)
@ -47,35 +67,8 @@ pl_js_npm_setsrc (char *option)
}
/**
* chsrc reset npm
*/
void
pl_js_npm_resetsrc (char *option)
{
pl_js_npm_setsrc (option);
}
/**
* chsrc ls npm
*/
Feature_t
pl_js_npm_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 = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_npm);
Target_t pl_js_npm_target = {def_target_inner_gsrf(pl_js_npm),def_target_sourcesn(pl_js_group)};

View File

@ -1,16 +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-09-23>
* Last Modified : <2025-06-19>
* ------------------------------------------------------------*/
/**
* chsrc get nvm
*/
def_target(pl_js_nvm);
void
pl_js_nvm_prelude (void)
{
use_this(pl_js_nvm);
chef_set_created_on (this, "2024-09-23");
chef_set_last_updated (this, "2025-06-19");
chef_set_sources_last_updated (this, "2025-06-19");
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);
chef_set_note ("nvm does not support Fish", "nvm 不支持 Fish shell");
// 使用 pl_js_binary_release 的源
this->sources = pl_js_binary_release_target.sources;
this->sources_n = pl_js_binary_release_target.sources_n;
}
void
pl_js_nvm_getsrc (char *option)
{
@ -23,9 +47,7 @@ pl_js_nvm_getsrc (char *option)
* @consult https://mirrors.tuna.tsinghua.edu.cn/help/nodejs-release/
* @issue https://github.com/RubyMetric/chsrc/issues/81
*
* chsrc set nvm
*
* @note nvm does not support Fish
* @note nvm Fish
*/
void
pl_js_nvm_setsrc (char *option)
@ -47,9 +69,6 @@ pl_js_nvm_setsrc (char *option)
}
/**
* chsrc reset nvm
*/
void
pl_js_nvm_resetsrc (char *option)
{
@ -57,27 +76,3 @@ pl_js_nvm_resetsrc (char *option)
chsrc_error ("暂不支持对 nvm 重置");
exit (Exit_Unsupported);
}
/**
* chsrc ls nvm
*/
Feature_t
pl_js_nvm_feat (char *option)
{
Feature_t f = {0};
f.can_get = true;
f.can_reset = false;
f.cap_locally = CanNot;
f.cap_locally_explain = "";
f.can_english = false;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_nvm);
Target_t pl_js_nvm_target = {def_target_inner_gsrf(pl_js_nvm),def_target_sourcesn(pl_js_binary_release)};

View File

@ -1,16 +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-04-18>
* Major Revision : 2
* Last Modified : <2025-07-11>
* ------------------------------------------------------------*/
/**
* chsrc get pnpm
*/
def_target(pl_js_pnpm);
void
pl_js_pnpm_prelude (void)
{
use_this(pl_js_pnpm);
chef_set_created_on (this, "2024-04-18");
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_js_group 的源
this->sources = pl_js_group_target.sources;
this->sources_n = pl_js_group_target.sources_n;
}
void
pl_js_pnpm_getsrc (char *option)
{
@ -21,8 +43,6 @@ pl_js_pnpm_getsrc (char *option)
/**
* @consult https://pnpm.io/feature-comparison
* @consult https://pnpm.io/cli/config
*
* chsrc set pnpm
*/
void
pl_js_pnpm_setsrc (char *option)
@ -48,36 +68,8 @@ pl_js_pnpm_setsrc (char *option)
}
/**
* chsrc reset pnpm
*/
void
pl_js_pnpm_resetsrc (char *option)
{
pl_js_pnpm_setsrc (option);
}
/**
* chsrc ls pnpm
*/
Feature_t
pl_js_pnpm_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 = true;
f.can_user_define = true;
f.note = NULL;
return f;
}
// def_target_gsrf(pl_js_pnpm);
Target_t pl_js_pnpm_target = {def_target_inner_gsrf(pl_js_pnpm),def_target_sourcesn(pl_js_group)};

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 ZjuPyPI服务在校外访问会自动转向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)};