From 7b04b72d4ba2cf5faaa6aaab910eddd5915cee61 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 22 Aug 2026 07:41:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(tpc):=20=E7=BF=BB=E8=AF=91=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=97=A5=E5=BF=97=E5=B8=A6=E6=BA=90=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=8E=E8=80=97=E6=97=B6=E2=80=94=E2=80=94?= =?UTF-8?q?=E5=B9=B6=E8=A1=8C=E6=97=B6=E4=B8=8D=E5=86=8D=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=20sha1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 用户反馈并行分支日志只有 -> xxx.ll(sha1 无文件名无耗时),看不到进度 - _translate_file 加计时,打印改为 '-> xxx.ll <源文件相对路径> (Xs)'(含仅声明分支) --- lib/Projectrans/Phase2Translator.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Projectrans/Phase2Translator.py b/lib/Projectrans/Phase2Translator.py index 355d4af..44f2b9e 100644 --- a/lib/Projectrans/Phase2Translator.py +++ b/lib/Projectrans/Phase2Translator.py @@ -1372,6 +1372,7 @@ class Phase2Translator: def _translate_file(self, src_path: str, out_path: str, prebuilt_ModuleSha1Map: dict[str, str] | None = None) -> None: """翻译单个源文件,嵌入相关 .stub.ll 声明""" + _t0: float = time.time() with open(src_path, 'r', encoding='utf-8') as f: code = f.read() @@ -1593,7 +1594,7 @@ class Phase2Translator: f.write(text_content) self._save_deps(sha1, ModuleSha1Map) - _vlog().info(f" -> {os.path.basename(out_path)}") + _vlog().info(f" -> {os.path.basename(out_path)} {os.path.relpath(src_path, self.src_root) if src_path else ''} ({time.time() - _t0:.1f}s)") else: stub_path = self.stub_files.get(sha1) if stub_path and os.path.exists(stub_path): @@ -1604,7 +1605,7 @@ class Phase2Translator: stub_content = f.read() with open(out_path, 'w', encoding='utf-8', newline='\n') as f: f.write(stub_content) - _vlog().info(f" -> {os.path.basename(out_path)} (仅声明)") + _vlog().info(f" -> {os.path.basename(out_path)} {os.path.relpath(src_path, self.src_root) if src_path else ''} (仅声明, {time.time() - _t0:.1f}s)") def _register_package_reexports(self, trans, init_pyi_path: str, package_name: str) -> None: """解析 __init__.pyi 中的 from .xxx import yyy 或 from __xxx import yyy,在包级别注册导出符号"""