@@ -157,7 +157,7 @@ def __build_addon(packet: str, addon: str, time_tag: str) -> None:
157157 squishy .write (f'Module "{ file_count } " "{ rel_dist_file } "\n ' )
158158
159159 # 调用squishy工具合并构建(使用minify full压缩级别)
160- os . popen ('lua "./!src-dist/tools/react/squish" --minify-level=full' ). read ( )
160+ utils . read_popen_output ('lua "./!src-dist/tools/react/squish" --minify-level=full' )
161161 # 删除临时生成的squishy配置文件
162162 os .remove ("squishy" )
163163
@@ -276,17 +276,17 @@ def __get_version_info(packet: str, diff_ver: Optional[str] = None) -> Dict[str,
276276 utils .exit_with_message (f"读取Base.lua文件出错:{ e } " )
277277
278278 # 获取当前最新提交短hash
279- current_hash : str = os .popen ('git log -n 1 --pretty=format:"%h"' ).read ().strip ()
279+ current_hash : str = utils .read_popen_output (
280+ 'git log -n 1 --pretty=format:"%h"'
281+ ).strip ()
280282 # 获取所有包含 release 信息的提交记录(以 SUCCESS|<hash>|release: <version> 格式保存)
281- commit_list : List [str ] = (
282- os .popen ('git log --grep release: --pretty=format:"SUCCESS|%h|%s"' )
283- .read ()
284- .split ("\n " )
285- )
283+ commit_list : List [str ] = utils .read_popen_output (
284+ 'git log --grep release: --pretty=format:"SUCCESS|%h|%s"'
285+ ).split ("\n " )
286286 if diff_ver :
287- extra_commit : str = os . popen (
287+ extra_commit : str = utils . read_popen_output (
288288 f'git log { diff_ver } -n 1 --pretty=format:"SUCCESS|%h|%s"'
289- ). read ()
289+ )
290290 commit_list += extra_commit .split ("\n " )
291291 commit_list = list (filter (lambda x : x and x .startswith ("SUCCESS|" ), commit_list ))
292292
@@ -443,8 +443,7 @@ def pathToModule(path: str) -> str:
443443 print ("--------------------------------" )
444444 print ("文件变更列表:" )
445445 filelist : List [str ] = (
446- os .popen (f"git diff { base_hash } HEAD --name-status" )
447- .read ()
446+ utils .read_popen_output (f"git diff { base_hash } HEAD --name-status" )
448447 .strip ()
449448 .split ("\n " )
450449 )
@@ -519,21 +518,16 @@ def __lint(packet: str, packet_path: str, diff_version: Optional[str] = None) ->
519518 start_hash = version_info .get ("previous_hash" ) or ""
520519 if not start_hash :
521520 # 如果没有上一版本,则获取3个月内最老的commit的hash
522- start_hash = (
523- os .popen (
524- 'git log --since="3 months ago" --format="%H" --reverse | head -n 1'
525- )
526- .read ()
527- .strip ()
528- )
521+ start_hash = utils .read_popen_output (
522+ 'git log --since="3 months ago" --format="%H" --reverse | head -n 1'
523+ ).strip ()
529524 if not start_hash :
530525 # 如果3个月内没有commit,则获取最新的commit hash
531- start_hash = os . popen ("git rev-parse HEAD" ). read ( ).strip ()
526+ start_hash = utils . read_popen_output ("git rev-parse HEAD" ).strip ()
532527
533528 # 获取从起始commit到当前的所有commit信息
534529 commits = (
535- os .popen (f'git log { start_hash } ..HEAD --pretty=format:"%h|%s"' )
536- .read ()
530+ utils .read_popen_output (f'git log { start_hash } ..HEAD --pretty=format:"%h|%s"' )
537531 .strip ()
538532 .split ("\n " )
539533 )
0 commit comments