2
2
* SPDX-License-Identifier: GPL-3.0-or-later
3
3
* -------------------------------------------------------------
4
4
* File Authors : happy game <[email protected] >
5
- * Contributors : Nul None <[email protected] >
5
+ * Contributors : ccy <[email protected] >
6
6
* Created On : <2024-12-11>
7
- * Last Modified : <2024-12-11 >
7
+ * Last Modified : <2025-04-02 >
8
8
* ------------------------------------------------------------*/
9
9
10
10
@@ -81,13 +81,18 @@ pl_python_uv_setsrc (char *option)
81
81
82
82
// sed -i '/^\[\[index\]\]$/,/^default = true$/{s|^url = ".*"$|url = " source.url "|}' uv_config
83
83
// 将 [[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 ,
85
91
"'/^\\[\\[index\\]\\]$/,/^default = true$/{s|^url = \".*\"$|url = \"" ,
86
92
source .url ,
87
- "\"|}' " ,
93
+ "\"|; }' " ,
88
94
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 );
91
96
92
97
// grep -q '^[[index]]$' uv_config && update_source_cmd || append_source_cmd
93
98
// 如果 uv_config 中存在 [[index]] 则更新, 否则追加到文件末尾
@@ -138,4 +143,4 @@ pl_python_uv_feat (char *option)
138
143
}
139
144
140
145
// 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