Skip to content

Commit b70e0c4

Browse files
authored
Merge pull request #186 from Kattos/main
fix config error in `uv.toml`
2 parents 51f8d59 + 40f0a96 commit b70e0c4

File tree

1 file changed

+12
-7
lines changed
  • src/recipe/lang/Python

1 file changed

+12
-7
lines changed

src/recipe/lang/Python/uv.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* SPDX-License-Identifier: GPL-3.0-or-later
33
* -------------------------------------------------------------
44
* File Authors : happy game <[email protected]>
5-
* Contributors : Nul None <[email protected]>
5+
* Contributors : ccy <[email protected]>
66
* Created On : <2024-12-11>
7-
* Last Modified : <2024-12-11>
7+
* Last Modified : <2025-04-02>
88
* ------------------------------------------------------------*/
99

1010

@@ -81,13 +81,18 @@ pl_python_uv_setsrc (char *option)
8181

8282
// sed -i '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = " source.url "|}' uv_config
8383
// 将 [[index]] 到 default = true 之间的 url = ".*" 替换为 url = "source.url"
84-
char *update_source_cmd = xy_strjoin (5, "sed -i ",
84+
#if xy_on_macos
85+
char *sed_cmd = "sed -i '' ";
86+
#else
87+
char *sed_cmd = "sed -i ";
88+
#endif
89+
90+
char *update_source_cmd = xy_strjoin (5, sed_cmd,
8591
"'/^\\[\\[index\\]\\]$/,/^default = true$/{s|^url = \".*\"$|url = \"",
8692
source.url,
87-
"\"|}' ",
93+
"\"|;}' ",
8894
uv_config);
89-
90-
char *append_source_cmd = xy_strjoin (4, "echo -e '", source_content, "' >> ", uv_config);
95+
char *append_source_cmd = xy_strjoin (4, "printf '", source_content, "' >> ", uv_config);
9196

9297
// grep -q '^[[index]]$' uv_config && update_source_cmd || append_source_cmd
9398
// 如果 uv_config 中存在 [[index]] 则更新, 否则追加到文件末尾
@@ -138,4 +143,4 @@ pl_python_uv_feat (char *option)
138143
}
139144

140145
// def_target_gsrf(pl_python_uv);
141-
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python)};
146+
Target_t pl_python_uv_target = {def_target_inner_gsrf(pl_python_uv),def_target_sourcesn(pl_python)};

0 commit comments

Comments
 (0)