Skip to content

Commit 8130f11

Browse files
committed
修复 Python 和 JavaScript 组中 target 的 ls 问题
1 parent 106cb97 commit 8130f11

File tree

10 files changed

+17
-27
lines changed

10 files changed

+17
-27
lines changed

src/framework/core.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,14 @@ source_has_empty_url (Source_t *source)
10231023
Source_t
10241024
chsrc_yield_source (Target_t *t, char *option)
10251025
{
1026+
/**
1027+
* 防止某些意外时刻 _setsrc() 等函数会被直接调,但此时 _prelude() 还没有执行过
1028+
* 我们在这里卡一道,确保 _prelude() 被调用
1029+
*
1030+
* 目前可能出现这种情况的时候:组换源的时候,组成菜的 _setsrc() 被直接调用
1031+
*/
1032+
if (!t->inited) t->preludefn();
1033+
10261034
Source_t source;
10271035
if (chsrc_in_target_group_mode() && ProgStatus.leader_selected_index==-1)
10281036
{

src/recipe/lang/JavaScript/Bun.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_js_bun_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 用的是 npm Registry 的源,所以使用 pl_js_group 的源
25-
this->sources = pl_js_group_target.sources;
26-
this->sources_n = pl_js_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_js_group_target);
2725
}
2826

2927
/**

src/recipe/lang/JavaScript/Yarn.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_js_yarn_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_js_group 的源
25-
this->sources = pl_js_group_target.sources;
26-
this->sources_n = pl_js_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_js_group_target);
2725
}
2826

2927
static double

src/recipe/lang/JavaScript/npm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_js_npm_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_js_group 的源
25-
this->sources = pl_js_group_target.sources;
26-
this->sources_n = pl_js_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_js_group_target);
2725
}
2826

2927

src/recipe/lang/JavaScript/nvm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ pl_js_nvm_prelude (void)
2323

2424
chef_set_note (this, "nvm 不支持 Fish shell", "nvm does not support Fish");
2525

26-
// 使用 pl_js_nodejs_binary 的源
27-
this->sources = pl_js_nodejs_binary_target.sources;
28-
this->sources_n = pl_js_nodejs_binary_target.sources_n;
26+
chef_use_other_target_sources (this, &pl_js_nodejs_binary_target);
2927
}
3028

3129

src/recipe/lang/JavaScript/pnpm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_js_pnpm_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_js_group 的源
25-
this->sources = pl_js_group_target.sources;
26-
this->sources_n = pl_js_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_js_group_target);
2725
}
2826

2927

src/recipe/lang/Python/Poetry.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_python_poetry_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_python_group 的源
25-
this->sources = pl_python_group_target.sources;
26-
this->sources_n = pl_python_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_python_group_target);
2725
}
2826

2927
void

src/recipe/lang/Python/Rye.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ pl_python_rye_prelude (void)
2323
chef_allow_english(this);
2424
chef_allow_user_define(this);
2525

26-
// 使用 pl_python_group 的源
27-
this->sources = pl_python_group_target.sources;
28-
this->sources_n = pl_python_group_target.sources_n;
26+
chef_use_other_target_sources (this, &pl_python_group_target);
2927
}
3028

3129
char *

src/recipe/lang/Python/pip.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_python_pip_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_python_group 的源
25-
this->sources = pl_python_group_target.sources;
26-
this->sources_n = pl_python_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_python_group_target);
2725
}
2826

2927

src/recipe/lang/Python/uv.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ pl_python_uv_prelude (void)
2121
chef_allow_english(this);
2222
chef_allow_user_define(this);
2323

24-
// 使用 pl_python_group 的源
25-
this->sources = pl_python_group_target.sources;
26-
this->sources_n = pl_python_group_target.sources_n;
24+
chef_use_other_target_sources (this, &pl_python_group_target);
2725
}
2826

2927

0 commit comments

Comments
 (0)