From ab4c767efc53ee2a1fcd8788155d1332192b2ce4 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Thu, 29 Oct 2026 23:54:50 +0800 Subject: [PATCH 01/13] Windows: the link probe's failure report survives the panel, and names the one suspect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The owner's second run used the new three-strategy probe and came back "link failed 3 ways" with the linker's self-check green (LLD 23.1.4 runs) — and the interesting part was cut off at the panel's edge, exactly where the answer lived. - The failure summary now keeps every attempt's last three output lines (not one), echoes the exact clang command to try by hand, and — when the SDK path is not pure ASCII — appends the fix that matches this machine: ld64.lld's Windows port can fail to open narrow-char paths while clang's front end (the compile probe, green there) handles them. The owner's SDK sits under C:\Users\QC-北\... — that hint is the most likely fix. - The panel moves a detail longer than ~140 characters into its own wrapped block under the row instead of eliding it to nothing. - Every not-ok dependency row is logged with its full detail, so an exported last-run.log always carries what the panel could not show. Verified: python3 -m unittest discover -s frontend-qt/tests -> 139 tests, 9 skipped, 0 failures (2 new: the summary names all strategies and the by-hand command, and flags a non-ASCII SDK path). --- frontend-qt/nspb_qt/localization.py | 2 + frontend-qt/nspb_qt/model.py | 7 ++ frontend-qt/nspb_qt/ui.py | 15 ++++ frontend-qt/nspb_qt/win/toolchain.py | 80 +++++++++++-------- frontend-qt/tests/test_win.py | 18 ++++- .../Sources/NSPortBuilder/Localization.swift | 3 + 6 files changed, 90 insertions(+), 35 deletions(-) diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py index 1e251d41b..7645a951e 100644 --- a/frontend-qt/nspb_qt/localization.py +++ b/frontend-qt/nspb_qt/localization.py @@ -634,6 +634,8 @@ 'dep.fix.brewMissing': ('没装 Homebrew:从 brew.sh 安装(安装程序会要你的密码),再点「重新检测」。', 'Homebrew is not installed: install it from brew.sh (the installer asks for your password), then press Check again.', 'Homebrew är inte installerat. Installera från brew.sh. Installationsprogrammet ber om ditt lösenord. Välj sedan ”Kontrollera igen”.'), 'dep.fix.xcodeLicense': ('Xcode 的许可协议还没接受:运行 sudo xcodebuild -license accept。', "Xcode's license is not accepted yet: run sudo xcodebuild -license accept.", 'Xcodes licensavtal är inte godkänt. Kör sudo xcodebuild -license accept.'), 'dep.fix.network': ('下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。', "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again.", 'Hämtningen misslyckades. Kontrollera nätverket; proxy eller VPN kan blockera Homebrews domäner. Försök sedan igen.'), + 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\\\NSPB\\\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it.", "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it."), + 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'dependency %@: [%@] %@'), 'dep.fix.diskspace': ('磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.'), 'dep.fix.log': ('完整输出在 Mac/iPhone 选择下面的日志里。', 'The full output is in the log under the Mac/iPhone choice.', 'Fullständig utdata finns i loggen under Mac/iPhone-valet.'), 'dep.python.missing': ('%@ 缺包', '%@ is missing packages', '%@ saknar paket'), diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.py index a27838c05..c1e0e53a5 100644 --- a/frontend-qt/nspb_qt/model.py +++ b/frontend-qt/nspb_qt/model.py @@ -299,6 +299,13 @@ def _check_deps(self) -> None: d.last_error, d.fix_hint = p.last_error, p.fix_hint self.deps = deps + # The panel can only show one row at a time; the log keeps every detail, so a report sent + # from a handheld always carries the full probe text (the truncated link row is why this + # exists). + for d in deps: + if not d.ok and d.detail: + self.log(self.t('dep.row.log', d.title_key.replace('dep.', 'dep.').replace('.hint', ''), + d.detail.replace('\n', ' | ')) + '\n') if not pu.IS_WIN: # On Windows `_windows_deps` already set python_path (the interpreter the app # installed, which find_python without its candidates cannot see) and dotnet_path diff --git a/frontend-qt/nspb_qt/ui.py b/frontend-qt/nspb_qt/ui.py index 6309c7eda..402147923 100644 --- a/frontend-qt/nspb_qt/ui.py +++ b/frontend-qt/nspb_qt/ui.py @@ -486,6 +486,21 @@ def _refresh_deps(self) -> None: detail = self.m.t(detail) elif detail: detail = pu.short_path(detail) + # A long detail (the link probe's three-attempt report) would be elided to nothing on + # one line: it moves into its own wrapped block under the row, where it is readable. + if len(detail) > 140 or '\n' in detail: + head = QLabel(detail[:120] + '…') + head.setObjectName('mono') + head.setTextInteractionFlags(Qt.TextSelectableByMouse) + h.addWidget(head, 1) + note = QLabel(detail) + note.setObjectName('mono') + note.setWordWrap(True) + note.setTextInteractionFlags(Qt.TextSelectableByMouse) + note.setContentsMargins(20, 0, 0, 4) + self.deps_container.addWidget(row) + self.deps_container.addWidget(note) + continue lab = QLabel(detail) lab.setObjectName('mono') lab.setTextInteractionFlags(Qt.TextSelectableByMouse) diff --git a/frontend-qt/nspb_qt/win/toolchain.py b/frontend-qt/nspb_qt/win/toolchain.py index 508f650a3..9bdee0f52 100644 --- a/frontend-qt/nspb_qt/win/toolchain.py +++ b/frontend-qt/nspb_qt/win/toolchain.py @@ -939,6 +939,32 @@ def probe_metal(sdk: Path) -> tuple[bool, str]: return True, f'{lib.stat().st_size} byte metallib for {tgt}' +def link_attempt_summary(r: subprocess.CompletedProcess) -> str: + """One failed strategy: the exit code plus the output's last lines (all of them, not just + one — '(no output)' alone was the report's whole diagnostic).""" + lines = (r.stderr or r.stdout or '').strip().splitlines() or ['(no output)'] + tail = ' | '.join(l.strip() for l in lines[-3:]) + return f'exit {r.returncode} (0x{r.returncode & 0xFFFFFFFF:08x}): {tail[:500]}' + + +def link_failure_summary(attempts: list[tuple[str, str, list[str]]], lld_line: str, + base: list[str], sdk: Path) -> str: + """Every failed strategy, the linker's self-check, the exact command to try by hand, and — + when the SDK lives under a non-ASCII path — the one hint that has fixed this exact shape + before: ld64.lld's Windows port can fail to open narrow-char paths silently, while clang's + front end (the compile probe) handles them fine. + """ + parts = [f'link failed {len(attempts)} ways; ld64.lld self-check: {lld_line[:140]}'] + for how, summary, _cmd in attempts: + parts.append(f'{how}: {summary}') + parts.append('try by hand: ' + ' '.join([*base, '-fuse-ld=lld', '-o', '%TEMP%\\probe.exe', ''])) + try: + str(sdk).encode('ascii') + except UnicodeEncodeError: + parts.append('dep.fix.nonascii') + return ' — '.join(parts) + + def probe_link(sdk: Path) -> tuple[bool, str]: """Link a tiny executable for iOS and check it is an arm64 MH_EXECUTE with an iOS platform. @@ -971,41 +997,27 @@ def probe_link(sdk: Path) -> tuple[bool, str]: target = f'-target arm64-apple-ios{IOS_DEPLOYMENT}'.split() base = [str(clang), *target, '-isysroot', str(sdk)] - def run(extra: list[str], env: dict[str, str] | None) -> subprocess.CompletedProcess: + # Strategies, in order: the build's own shape first (build_app.link drives the linker + # with -fuse-ld=lld and the linker's folder on PATH — if the probe cannot link that way, + # neither can the build), then naming the linker directly, then -B as clang's last + # resort. Each failure is kept; all three failing produces the full report. + attempts: list[tuple[str, str, list[str]]] = [] # (strategy, summary, command) + for how, extra, env in ( + ('fuse-ld (build-style)', ['-fuse-ld=lld'], None), + ('ld-path', ['-fuse-ld=lld', f'--ld-path={lld}'], None), + ('-B dir', [f'-B{lld.parent}', '-fuse-ld=lld'], None)): + run_env = dict(os.environ) # a child on Windows needs the full env (SystemRoot etc.) + if extra[:1] == ['-fuse-ld=lld'] and how.startswith('fuse-ld'): + run_env['PATH'] = str(lld.parent) + os.pathsep + run_env.get('PATH', '') cmd = [*base, *extra, '-o', str(out), str(c)] - return subprocess.run(cmd, capture_output=True, text=True, timeout=180, - env=env, **no_window()) - - def summary(r: subprocess.CompletedProcess) -> str: - # the exit code is the evidence: 0xC0000135 (STATUS_DLL_NOT_FOUND) reads as "a DLL is - # missing", not "the linker is bad"; an empty stream pair stays honest as (no output) - tail = ((r.stderr or r.stdout or '').strip().splitlines() or ['(no output)'])[-1] - return f'exit {r.returncode} (0x{r.returncode & 0xFFFFFFFF:08x}): {tail[:400]}' - - # Strategy 1 — the build's own shape (build_app.link): -fuse-ld=lld and the linker's - # folder on PATH. If the machine's PATH handling differs from the probe's assumptions, - # this is what the build would do, so it is the first thing to try. - env = dict(os.environ) # a child on Windows needs the full env (SystemRoot etc.) - env['PATH'] = str(lld.parent) + os.pathsep + env.get('PATH', '') - r = run(['-fuse-ld=lld'], env) - if r.returncode == 0: - how = 'fuse-ld (build-style)' - else: - first = summary(r) - # Strategy 2 — name the linker directly (--ld-path), bypassing every lookup. - r = run(['-fuse-ld=lld', f'--ld-path={lld}'], dict(os.environ)) + r = subprocess.run(cmd, capture_output=True, text=True, timeout=180, + env=run_env, **no_window()) if r.returncode == 0: - how = 'ld-path' - else: - second = summary(r) - # Strategy 3 — -fuse-ld=full or the absolute path as -B: clang's last resort - r = run([f'-B{lld.parent}', '-fuse-ld=lld'], dict(os.environ)) - if r.returncode == 0: - how = '-B dir' - else: - third = summary(r) - return False, (f'link failed 3 ways; ld64.lld self-check: {lld_line[:120]}; ' - f'fuse-ld {first}; ld-path {second}; -B {third}') + how_ok = how + break + attempts.append((how, link_attempt_summary(r), cmd)) + else: + return False, link_failure_summary(attempts, lld_line, base, sdk) try: data = out.read_bytes() except OSError as e: @@ -1020,7 +1032,7 @@ def summary(r: subprocess.CompletedProcess) -> str: plat = macho_platform(data) if plat is not None and plat != PLATFORM_IOS: return False, f'platform {plat} is not iOS ({PLATFORM_IOS})' - return True, f'arm64 MH_EXECUTE{"" if plat is None else f", platform {plat}"}, {len(data)} bytes ({how})' + return True, f'arm64 MH_EXECUTE{"" if plat is None else f", platform {plat}"}, {len(data)} bytes ({how_ok})' def macho_platform(data: bytes) -> int | None: diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.py index c1206e48c..4b6a150e4 100644 --- a/frontend-qt/tests/test_win.py +++ b/frontend-qt/tests/test_win.py @@ -1684,11 +1684,27 @@ def test_the_strategy_order_is_build_style_first(self) -> None: 'the build\'s own invocation must be tried before --ld-path') self.assertLess(body.index('f\'--ld-path={lld}\''), body.index("f'-B{lld.parent}'"), '--ld-path before the -B fallback') - self.assertIn("env['PATH'] = str(lld.parent)", body, + self.assertIn("run_env['PATH'] = str(lld.parent)", body, 'the build-style try must put the linker folder on PATH (build_app.link does)') self.assertIn('does not run by itself', body, 'a linker that cannot start is its own message, before any strategy runs') + def test_the_failure_summary_names_everything_and_flags_a_non_ascii_sdk(self) -> None: + from nspb_qt.win import toolchain as tc + attempts = [('fuse-ld', 'exit 1 (0x00000001): (no output)', ['clang', '-fuse-ld=lld']), + ('ld-path', 'exit 1 (0x00000001): (no output)', ['clang', '--ld-path=x']), + ('-B dir', 'exit 1 (0x00000001): (no output)', ['clang', '-Bx'])] + plain = Path('C:/sdks/iPhoneOS26.0.sdk') + summary = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], plain) + for part in ('link failed 3 ways', 'LLD 23.1.4', 'fuse-ld:', 'ld-path:', '-B dir:', + 'try by hand:'): + self.assertIn(part, summary, part) + self.assertNotIn('dep.fix.nonascii', summary) + # The owner's machine: C:\Users\QC-北\... — the SDK itself sits under a non-ASCII path + nonascii = Path('C:/Users/QC-北/AppData/Local/NS Port Builder/sdks/iPhoneOS26.0.sdk') + hinted = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], nonascii) + self.assertIn('dep.fix.nonascii', hinted) + class InstallFailureHintTest(unittest.TestCase): """The row's fix hint after a failed install (Mac parity: name the fix, not the traceback).""" diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift index 36f8dbf2b..69b22fe2f 100644 --- a/frontend/Sources/NSPortBuilder/Localization.swift +++ b/frontend/Sources/NSPortBuilder/Localization.swift @@ -735,6 +735,9 @@ enum L10n { "Xcode's license is not accepted yet: run sudo xcodebuild -license accept."), "dep.fix.network": ("下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。", "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again."), + "dep.fix.nonascii": ("SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\NSPB\\sdk),然后在依赖面板用「选择文件夹…」指向它。", + "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\NSPB\\sdk) and point the dependencies panel's Choose folder… at it."), + "dep.row.log": ("依赖 %@:[%@] %@", "dependency %@: [%@] %@"), "dep.fix.diskspace": ("磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。", "The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again."), "dep.fix.log": ("完整输出在 Mac/iPhone 选择下面的日志里。", From 6383796bc6c2ec6feb64473e471f3d32111d0db2 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 02:27:54 +0800 Subject: [PATCH 02/13] Windows: the Metal zip the player downloads is installed by the app MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Mac build bundles every tool it may; the Windows build auto-downloads all of them but one — Metal Developer Tools, which Apple gates behind an Apple ID, so the browser download is the licensed path. Until now the app stopped there: the row linked the download page and accepted an already unpacked folder. The Metal row's button now takes the downloaded zip itself: it is validated (metal.exe in bin/ for 5.x/6.x or ios/bin/ for 4.x), unpacked into the tools folder the other toolchains live in — surviving app updates — and the folder is remembered in toolchain.json. An already unpacked folder is equally accepted, and a zip without metal.exe is refused with what to check. The player's part shrinks to: download from Apple, pick the zip. Verified: python3 -m unittest discover -s frontend-qt/tests -> 142 tests, 9 skipped, 0 failures (3 new: a 6.x-layout zip unpacks into the tools dir with staging cleaned, a 4.x ios/bin layout is accepted, a zip without metal.exe is refused leaving nothing behind; plus the routing shape test). --- frontend-qt/nspb_qt/localization.py | 6 +- frontend-qt/nspb_qt/model.py | 49 +++++++++++++ frontend-qt/nspb_qt/ui.py | 15 +++- frontend-qt/nspb_qt/win/fetch.py | 48 +++++++++++++ frontend-qt/tests/test_win.py | 69 +++++++++++++++++++ .../Sources/NSPortBuilder/Localization.swift | 6 +- 6 files changed, 189 insertions(+), 4 deletions(-) diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py index 7645a951e..b41eb245c 100644 --- a/frontend-qt/nspb_qt/localization.py +++ b/frontend-qt/nspb_qt/localization.py @@ -611,7 +611,11 @@ 'dep.show': ('展开', 'Show', 'Show'), 'dep.pick': ('选择文件夹…', 'Choose folder…', 'Choose folder…'), 'dep.pick.ios_sdk.title': ('选择 iPhoneOS SDK 文件夹', 'Choose the iPhoneOS SDK folder', 'Choose the iPhoneOS SDK folder'), - 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools 文件夹', 'Choose the Metal Developer Tools folder', 'Choose the Metal Developer Tools folder'), + 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)'), + 'dep.pick.metal': ('选择 zip / 文件夹…', 'Choose zip / folder…', 'Choose zip / folder…'), + 'dep.metal.unpacking': ('正在解压 %@…', 'Unpacking %@…', 'Unpacking %@…'), + 'dep.metal.done': ('Metal Developer Tools 已安装:%@', 'Metal Developer Tools installed: %@', 'Metal Developer Tools installed: %@'), + 'dep.pick.metal.invalid': ('“%@”里没有 metal.exe(需要 bin\\\\metal.exe 或 ios\\\\bin\\\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。', 'No metal.exe inside "%@" (needs bin\\\\metal.exe or ios\\\\bin\\\\metal.exe): check that the download is "Metal Developer Tools for Windows".', 'No metal.exe inside "%@" (needs bin\\\\metal.exe or ios\\\\bin\\\\metal.exe): check that the download is "Metal Developer Tools for Windows".'), 'dep.pick.saved': ('已记住:%@', 'Remembered: %@', 'Remembered: %@'), 'dep.pick.iossdk.saved': ('SDK 已记住:%@', 'SDK remembered: %@', 'SDK remembered: %@'), 'dep.pick.iossdk.version': ('SDK 版本:%@', 'SDK version: %@', 'SDK version: %@'), diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.py index c1e0e53a5..0c36cda9d 100644 --- a/frontend-qt/nspb_qt/model.py +++ b/frontend-qt/nspb_qt/model.py @@ -81,6 +81,9 @@ class Model(QObject): #: Set by the window: asks for a folder (QFileDialog lives in the UI layer) and returns the #: path, or '' when the user cancelled. `pick_dep_folder` calls it, so the model stays UI-free. ask_folder: Callable[[str], str] | None = None + #: Same, for a file ('Metal Developer Tools*.zip' the user downloaded from Apple). + ask_file: Callable[[str], str] | None = None + _metal_zip: Path | None = None def __init__(self) -> None: super().__init__() @@ -754,6 +757,16 @@ def work() -> None: path = sf.clone_sdk(log=lambda s: self.log(str(s) + '\n')) self.log(self.t('dep.iossdk.done', str(path)) + '\n') ok = True + elif what == 'metal_zip': + # Apple's tools are Apple-ID-gated: the browser download is the licensed + # path, the app does the unpack and remembers the folder. + self.log(self.t('dep.metal.unpacking', self._metal_zip.name) + '\n') + from .win import fetch as wf + dest = wf.install_metal_from_zip(self._metal_zip, + log=lambda s: self.log(str(s) + '\n')) + wtc.save_config('metal_dir', str(dest)) + self.log(self.t('dep.metal.done', str(dest)) + '\n') + ok = True else: self.log(f'unknown Windows install target: {what}\n') except Exception as e: @@ -803,6 +816,19 @@ def pick_dep_folder(self, dep: Dep) -> None: if not dep.pick_key: return from .win import toolchain as wtc + if dep.pick_key == 'metal_dir': + # The Metal zip is a file, not a folder: the ask_file callback (the window's file + # dialog filters *.zip) takes the browser download straight away. An already + # unpacked folder is equally accepted. + ask_file = self.ask_file + if ask_file is None: + return + picked = ask_file(self.t('dep.pick.metal_dir.title')) + if not picked: + return + if picked.lower().endswith('.zip'): + return self.install_metal_zip(Path(picked)) + return self._save_metal_folder(Path(picked)) ask = self.ask_folder if ask is None: return # no window attached (tests): nothing to ask with @@ -826,6 +852,29 @@ def pick_dep_folder(self, dep: Dep) -> None: self.log(self.t('dep.pick.saved', folder) + '\n') self.check_deps() + def _save_metal_folder(self, folder: Path) -> None: + """A folder the user already unpacked: validate the two layouts metal_dir() accepts.""" + from .win import toolchain as wtc + if not (folder / 'bin' / 'metal.exe').is_file() and \ + not (folder / 'ios' / 'bin' / 'metal.exe').is_file(): + self.log(self.t('dep.pick.metal.invalid', str(folder)) + '\n') + return + wtc.save_config('metal_dir', str(folder)) + self.log(self.t('dep.pick.saved', str(folder)) + '\n') + self.check_deps() + + def install_metal_zip(self, zip_path: Path) -> None: + """Unpack the Apple zip the player downloaded and remember the folder (the one manual + dependency on Windows: Apple-ID-gated, so the app cannot fetch it itself).""" + if not zip_path.is_file(): + self.log(self.t('dep.pick.metal.invalid', str(zip_path)) + '\n') + return + self._metal_zip = zip_path + dep = next((d for d in self.deps if d.id == 'metal'), None) + if dep is None: + return + self._install_win(dep, 'metal_zip') + def _progress_logger(self, label: str): """A progress callback that logs at 5% steps, not on every chunk. diff --git a/frontend-qt/nspb_qt/ui.py b/frontend-qt/nspb_qt/ui.py index 402147923..8212a3bb1 100644 --- a/frontend-qt/nspb_qt/ui.py +++ b/frontend-qt/nspb_qt/ui.py @@ -77,6 +77,8 @@ def __init__(self, model: Model) -> None: self.m.finished.connect(self._on_finished) self._refresh_all() + self.m.ask_folder = lambda title: self._ask_folder(title) + self.m.ask_file = lambda title: self._ask_file(title) self.m.check_deps() # ---------------------------------------------------------------- header @@ -515,8 +517,9 @@ def _refresh_deps(self) -> None: h.addWidget(btn) if d.pick_key: # Apple-licensed pieces cannot be downloaded by the app: Choose points at a - # copy the user already has (validated, remembered in toolchain.json). - pick = QPushButton(self.m.t('dep.pick')) + # copy the user already has — an unpacked folder, or (Metal) the downloaded + # zip, which the app unpacks and remembers. + pick = QPushButton(self.m.t('dep.pick.metal' if d.pick_key == 'metal_dir' else 'dep.pick')) pick.clicked.connect(lambda _=False, dep=d: self.m.pick_dep_folder(dep)) h.addWidget(pick) if not d.install and not d.pick_key: @@ -690,6 +693,14 @@ def _build_clicked(self) -> None: self.failure_box.hide() self.m.start_build() + def _ask_folder(self, title: str) -> str: + d = QFileDialog.getExistingDirectory(self, title) + return d or '' + + def _ask_file(self, title: str) -> str: + d, _ = QFileDialog.getOpenFileName(self, title, '', 'Metal tools zip (*.zip)') + return d or '' + def _choose_repo(self) -> None: d = QFileDialog.getExistingDirectory(self, self.m.t('repo.pickMessage')) if d: diff --git a/frontend-qt/nspb_qt/win/fetch.py b/frontend-qt/nspb_qt/win/fetch.py index 3014969ba..9750d0a39 100644 --- a/frontend-qt/nspb_qt/win/fetch.py +++ b/frontend-qt/nspb_qt/win/fetch.py @@ -558,3 +558,51 @@ def _download_unverified(url: str, dest: Path, log: Callable[[str], None], except (urllib.error.URLError, OSError) as e: tmp.unlink(missing_ok=True) raise DownloadError(f'download failed: {url}: {e}') from e + + +def install_metal_from_zip(zip_path: Path, dest: Path | None = None, + log: Callable[[str], None] | None = None) -> Path: + """Unpack a "Metal Developer Tools for Windows" zip the user downloaded from Apple, and + return the folder to write into `toolchain.json` as `metal_dir`. + + Apple's tools are Apple-ID-gated and cannot be downloaded by the app; the browser download + is the licensed path, and this is the app doing the unpack the user would otherwise do by + hand — into `tools_dir()`, the same place the other toolchains live, surviving app updates. + The zip is validated before anything is remembered: it must contain `metal.exe` (5.x/6.x in + `bin/`, 4.x in `ios/bin/`), matching `toolchain.metal_dir()`'s two accepted layouts. + """ + import zipfile as _zf + src = Path(zip_path) + if not src.is_file(): + raise DownloadError(f'{src} does not exist') + if log: + log(f'unpacking {src.name} …') + dest = Path(dest) if dest else tc.tools_dir() / 'metal-developer-tools' + staging = dest.parent / (dest.name + '-staging') + shutil.rmtree(staging, ignore_errors=True) + staging.mkdir(parents=True) + try: + with _zf.ZipFile(src) as z: + bad = [i.filename for i in z.infolist() if i.filename.startswith('/') or '..' in Path(i.filename).parts] + if bad: + raise DownloadError(f'unsafe paths inside {src.name}: {bad[:3]}') + z.extractall(staging) + except _zf.BadZipFile as e: + shutil.rmtree(staging, ignore_errors=True) + raise DownloadError(f'{src.name} is not a zip file ({e})') from e + + def has_metal(root: Path) -> bool: + return (root / 'bin' / 'metal.exe').is_file() or (root / 'ios' / 'bin' / 'metal.exe').is_file() + + roots = [staging] + [p for p in staging.iterdir() if p.is_dir()] # zip may or may not carry a top folder + hit = next((r for r in roots if has_metal(r)), None) + if hit is None: + shutil.rmtree(staging, ignore_errors=True) + raise DownloadError(f'{src.name} does not look like Metal Developer Tools ' + '(no metal.exe in bin/ or ios/bin/)') + shutil.rmtree(dest, ignore_errors=True) + hit.rename(dest) + shutil.rmtree(staging, ignore_errors=True) + if log: + log(f'Metal Developer Tools unpacked to {dest}') + return dest diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.py index 4b6a150e4..0d297f82d 100644 --- a/frontend-qt/tests/test_win.py +++ b/frontend-qt/tests/test_win.py @@ -1706,6 +1706,75 @@ def test_the_failure_summary_names_everything_and_flags_a_non_ascii_sdk(self) -> self.assertIn('dep.fix.nonascii', hinted) +class MetalPickFlowShapeTest(unittest.TestCase): + """The model wiring (source-shape, since model.py needs PySide6): the metal row asks for a + file, takes a zip to install_metal_zip, a folder to _save_metal_folder.""" + + def test_the_metal_row_routes_zip_and_folder(self) -> None: + src = (QT / 'nspb_qt' / 'model.py').read_text() + body = src[src.index("if dep.pick_key == 'metal_dir':"):] + self.assertIn('ask_file', body, 'the metal row must ask for a file (the zip)') + self.assertIn('install_metal_zip', body) + self.assertIn('_save_metal_folder', body) + self.assertIn("endswith('.zip')", body) + + +class MetalZipInstallTest(unittest.TestCase): + """The one manual dependency (Apple-ID-gated Metal tools) handed a downloaded zip: the app + unpacks, validates both shipped layouts, and refuses anything else.""" + + def setUp(self) -> None: + self.tmp = tempfile.TemporaryDirectory() + self.addCleanup(self.tmp.cleanup) + self.root = Path(self.tmp.name) + + @staticmethod + def _fake_tools(root: Path, layout: str) -> Path: + bin_ = root / ('ios/bin' if layout == '4.x' else 'bin') + bin_.mkdir(parents=True) + (bin_ / 'metal.exe').write_bytes(b'MZ') + (bin_ / 'metallib.exe').write_bytes(b'MZ') + return root + + def test_a_zip_with_the_tools_unpacks_to_the_tools_dir(self) -> None: + from nspb_qt.win import fetch as wf + tools = self.root / 'tools' + src = self._fake_tools(self.root / 'unpacked', '6.x') + zip_path = self.root / 'Metal Developer Tools 6.0.zip' + import zipfile + with zipfile.ZipFile(zip_path, 'w') as z: + for f in src.rglob('*'): + z.write(f, f.relative_to(src.parent)) + dest = wf.install_metal_from_zip(zip_path, dest=tools / 'metal-developer-tools') + self.assertTrue((dest / 'bin' / 'metal.exe').is_file()) + self.assertFalse((tools / 'metal-developer-tools-staging').exists(), 'staging is cleaned up') + + def test_a_4x_layout_zip_is_accepted_by_its_ios_folder(self) -> None: + from nspb_qt.win import fetch as wf + src = self._fake_tools(self.root / 'u4', '4.x') + zip_path = self.root / 'metal4.zip' + import zipfile + with zipfile.ZipFile(zip_path, 'w') as z: + for f in src.rglob('*'): + z.write(f, f.relative_to(src.parent)) + dest = wf.install_metal_from_zip(zip_path, dest=self.root / 'tools' / 'm4') + self.assertTrue((dest / 'ios' / 'bin' / 'metal.exe').is_file()) + + def test_a_zip_without_metal_exe_is_refused_and_leaves_nothing_behind(self) -> None: + from nspb_qt.win import fetch as wf + zip_path = self.root / 'not-metal.zip' + import zipfile + with zipfile.ZipFile(zip_path, 'w') as z: + (self.root / 'junk').mkdir() + (self.root / 'junk' / 'readme.txt').write_text('x', encoding='utf-8') + z.write(self.root / 'junk' / 'readme.txt', 'stuff/readme.txt') + tools = self.root / 'tools' + with self.assertRaises(wf.DownloadError): + wf.install_metal_from_zip(zip_path, dest=tools / 'm') + self.assertFalse((tools / 'm').exists()) + self.assertFalse((tools / 'm-staging').exists()) + + class InstallFailureHintTest(unittest.TestCase): """The row's fix hint after a failed install (Mac parity: name the fix, not the traceback).""" diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift index 69b22fe2f..925e8ebe2 100644 --- a/frontend/Sources/NSPortBuilder/Localization.swift +++ b/frontend/Sources/NSPortBuilder/Localization.swift @@ -706,7 +706,11 @@ enum L10n { "dep.show": ("展开", "Show"), "dep.pick": ("选择文件夹…", "Choose folder…"), "dep.pick.ios_sdk.title": ("选择 iPhoneOS SDK 文件夹", "Choose the iPhoneOS SDK folder"), - "dep.pick.metal_dir.title": ("选择 Metal Developer Tools 文件夹", "Choose the Metal Developer Tools folder"), + "dep.pick.metal_dir.title": ("选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)", "Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)"), + "dep.pick.metal": ("选择 zip / 文件夹…", "Choose zip / folder…"), + "dep.metal.unpacking": ("正在解压 %@…", "Unpacking %@…"), + "dep.metal.done": ("Metal Developer Tools 已安装:%@", "Metal Developer Tools installed: %@"), + "dep.pick.metal.invalid": ("“%@”里没有 metal.exe(需要 bin\\metal.exe 或 ios\\bin\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。", "No metal.exe inside \"%@\" (needs bin\\metal.exe or ios\\bin\\metal.exe): check that the download is \"Metal Developer Tools for Windows\"."), "dep.pick.saved": ("已记住:%@", "Remembered: %@"), "dep.pick.iossdk.saved": ("SDK 已记住:%@", "SDK remembered: %@"), "dep.pick.iossdk.version": ("SDK 版本:%@", "SDK version: %@"), From 6d09bec8a733416615f61fba178f04e606f0d8a5 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 02:42:02 +0800 Subject: [PATCH 03/13] Windows: install-all follows multi-step fixes, the SDK installs its own git, and the venv packages ride in the zip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three gaps from the owner's fresh-machine run (new user, nothing installed): - Install all stopped after the Python interpreter: the loop's attempted set was keyed by id, so the row's SECOND fix (venv + pip packages, which replaces the interpreter row the pass had just created) was skipped as "already tried" — the docstring promised the opposite. attempted is now keyed by (id, fix): a row whose install command changed is retried, a genuinely failed one is not. - The SDK clone failed three times with "git is not installed". The clone needs git, but git was only ever installed by the repository-download flow, which a fresh machine never runs. The SDK install now downloads PortableGit itself (per-user, the same helper the repo flow uses — toolchain.git_exe() already looks there) before cloning. - The log carried literal "dependency %@: [%@] %@" lines: the new row-logging call passed two arguments to a three-placeholder string, and t()'s format-failure fallback kept the raw text. Three args now. **Python + packages, bundled** (the owner's ask): the release workflow downloads the venv wheels (lz4, capstone, fonttools, backports.zstd, nsz) at packaging time and puts wheels/ beside the exe; the venv step installs from disk (--no-index) — no PyPI round-trip, seconds not minutes. Source runs keep the PyPI path. Wheels are ~15 MB in the zip. Metal stays as agreed: user downloads from Apple (Apple ID), the app unpacks the picked zip and remembers the folder. Verified: python3 -m unittest discover -s frontend-qt/tests -> 146 tests, 9 skipped, 0 failures (4 new: offline/online pip args, the log row string with three args, plus the metal-zip and pick-flow tests from this branch). --- .github/workflows/build-qt.yml | 8 +++++ frontend-qt/nspb_qt/model.py | 58 ++++++++++++++++++++++++++++++---- frontend-qt/tests/test_win.py | 23 +++++++++++++- 3 files changed, 81 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index 934bb2cbb..7ef50981a 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -38,6 +38,13 @@ jobs: - name: Generate the localisation table run: python frontend-qt/gen_localization.py + # The build packages ride in the zip: the venv step then installs from disk (--no-index), + # so a fresh machine needs no PyPI round-trip for lz4/capstone/fonttools/nsz. The runner's + # Python is the version these wheels target (3.12), matching the interpreter the app + # installs for its venv. + - name: Download the venv wheels + run: python -m pip download lz4 capstone fonttools backports.zstd nsz -d frontend-qt/wheels + - name: Build working-directory: frontend-qt shell: bash @@ -123,6 +130,7 @@ jobs: shell: bash run: | cd frontend-qt/dist + cp -r ../wheels "NS Port Builder/wheels" powershell -Command "Compress-Archive -Path 'NS Port Builder' -DestinationPath '../NS-Port-Builder-qt-windows-x64.zip'" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.py index 0c36cda9d..e8c1cba62 100644 --- a/frontend-qt/nspb_qt/model.py +++ b/frontend-qt/nspb_qt/model.py @@ -307,7 +307,10 @@ def _check_deps(self) -> None: # exists). for d in deps: if not d.ok and d.detail: - self.log(self.t('dep.row.log', d.title_key.replace('dep.', 'dep.').replace('.hint', ''), + # three placeholders, three args: a mismatch makes t() fall back to the raw + # "dependency %@: [%@] %@" line (the report's log had it six times) + name = d.title_key.replace('dep.', '').replace('.hint', '') + self.log(self.t('dep.row.log', name, d.state.value, d.detail.replace('\n', ' | ')) + '\n') if not pu.IS_WIN: # On Windows `_windows_deps` already set python_path (the interpreter the app @@ -754,6 +757,14 @@ def work() -> None: elif what == 'ios_sdk': self.log(self.t('dep.iossdk.downloading') + '\n') from .win import sdk_fetch as sf + # clone_sdk runs git, which a fresh machine has none of: the app installs + # PortableGit itself (per-user, no installer) instead of sending the player + # to git-scm.com — the report's SDK row failed three times on exactly that. + if not (wtc.git_exe() or shutil.which('git')): + self.log(self.t('dep.git.downloading') + '\n') + from .win import fetch as wf + git = wf.install_git(log=lambda s: self.log(str(s) + '\n')) + self.log(self.t('dep.git.done', str(git)) + '\n') path = sf.clone_sdk(log=lambda s: self.log(str(s) + '\n')) self.log(self.t('dep.iossdk.done', str(path)) + '\n') ok = True @@ -895,6 +906,26 @@ def report(done: int, total: int) -> None: return report + @staticmethod + def bundled_wheels() -> Path | None: + """The wheel folder shipped in the Windows zip (`wheels/` beside the exe). + + The build packages (lz4, capstone, fonttools, nsz, backports.zstd) are downloaded by the + release workflow at packaging time, so the venv step installs from disk with no network + and no PyPI — the same "the app carries it" promise the Mac's bundled CPython makes. + Source runs have no such folder and fall back to PyPI. + """ + base = getattr(sys, '_MEIPASS', None) or Path(sys.executable).parent + w = Path(base) / 'wheels' + return w if w.is_dir() and any(w.glob('*.whl')) else None + + @staticmethod + def _pip_args(pkgs: list[str], wheels: Path | None) -> list[str]: + """pip's arguments: offline from the bundled wheels when they cover the packages.""" + if wheels: + return ['install', '--no-index', '--find-links', str(wheels)] + pkgs + return ['install'] + pkgs + def _make_venv(self, base: str) -> bool: """Create or reuse the app's venv and install the build packages into it.""" vpy = pu.venv_python() @@ -935,9 +966,12 @@ def _make_venv(self, base: str) -> bool: pkgs = ['lz4', 'capstone', 'fonttools', 'nsz'] if ver < (3, 14): pkgs.insert(3, 'backports.zstd') - self.log(f'$ {vpy} -m pip install {" ".join(pkgs)}\n') + wheels = self.bundled_wheels() + args = self._pip_args(pkgs, wheels) + self.log(f'$ {vpy} -m pip {" ".join(args)}' + + ('' if wheels else ' (from PyPI)') + '\n') try: - p = subprocess.Popen([vpy, '-m', 'pip', 'install'] + pkgs, stdout=subprocess.PIPE, + p = subprocess.Popen([vpy, '-m', 'pip'] + args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True, errors='replace', env=pu.child_env(), **pu.no_window_kwargs()) assert p.stdout is not None @@ -975,10 +1009,18 @@ def install_all_missing(self) -> None: def run_all() -> None: try: - attempted: set[str] = set() + # attempted is keyed by (id, fix): an id may legitimately come back in a later + # pass with a DIFFERENT fix — installing the Python interpreter turns its row + # into "pip install the packages", which is exactly the step install-all must + # then run (the report: only the interpreter was installed, the packages step + # needed a second click on the row). + attempted: dict[str, tuple] = {} while True: - rows = [d for d in self.deps if not d.ok and d.install - and d.id not in attempted] + def pending(d) -> bool: + if d.ok or not d.install: + return False + return attempted.get(d.id) != tuple(d.install) + rows = [d for d in self.deps if pending(d)] if not rows: break progressed = False @@ -986,7 +1028,9 @@ def run_all() -> None: live = next((r for r in self.deps if r.id == d.id), None) if live is None or live.ok or not live.install or live.installing: continue - attempted.add(live.id) + if attempted.get(live.id) == tuple(live.install): + continue + attempted[live.id] = tuple(live.install) self.log(f'--- {self.t(live.title_key)} ---\n') self.install_dep(live) progressed = True diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.py index 0d297f82d..5f09bc4be 100644 --- a/frontend-qt/tests/test_win.py +++ b/frontend-qt/tests/test_win.py @@ -1706,6 +1706,27 @@ def test_the_failure_summary_names_everything_and_flags_a_non_ascii_sdk(self) -> self.assertIn('dep.fix.nonascii', hinted) +class VenvWheelsTest(unittest.TestCase): + """The build packages ride in the zip: the venv installs offline from wheels/ beside the + exe when it is there, and from PyPI exactly as before when it is not (source runs).""" + + def test_offline_args_when_wheels_are_bundled(self) -> None: + from nspb_qt import model as M + args = M.Model._pip_args(['lz4', 'nsz'], Path('C:/app/wheels')) + self.assertEqual(args, ['install', '--no-index', '--find-links', 'C:/app/wheels', 'lz4', 'nsz']) + + def test_pypi_args_when_not_bundled(self) -> None: + from nspb_qt import model as M + self.assertEqual(M.Model._pip_args(['lz4'], None), ['install', 'lz4']) + + def test_the_log_row_string_takes_three_args(self) -> None: + from nspb_qt.i18n import Lang + from nspb_qt.localization import t + out = t('dep.row.log', Lang.EN, 'python', 'missing', 'C:/x | found') + self.assertEqual(out, 'dependency python: [missing] C:/x | found', 'the report log showed raw %@ placeholders') + self.assertTrue(t('dep.row.log', Lang.ZH, 'python', 'missing', 'd'), 'Chinese side is filled too') + + class MetalPickFlowShapeTest(unittest.TestCase): """The model wiring (source-shape, since model.py needs PySide6): the metal row asks for a file, takes a zip to install_metal_zip, a folder to _save_metal_folder.""" @@ -1783,7 +1804,7 @@ def test_network_disk_and_other_map_to_their_hints(self) -> None: # pure function, so its source is extracted and run standalone when Qt is absent. try: from nspb_qt import model as M - classify = M.BuildModel._classify_install_failure + classify = M.Model._classify_install_failure except ImportError: import ast src = (HERE.parent / 'nspb_qt' / 'model.py').read_text() From 265496a53de2901607c96e16c6d099f3e7f134ef Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 02:52:41 +0800 Subject: [PATCH 04/13] Windows: name the PortableGit step in the log, and ignore the wheels folder --- .gitignore | 2 ++ frontend-qt/nspb_qt/localization.py | 2 ++ frontend/Sources/NSPortBuilder/Localization.swift | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index a13261773..cd3ef4598 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ frontend/NX2Apple.app/ # the virtual environment the README creates for the Python packages .venv/ +frontend-qt/wheels/ +frontend-qt/NS-Port-Builder-qt-windows-x64.zip diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py index b41eb245c..440b0c5a9 100644 --- a/frontend-qt/nspb_qt/localization.py +++ b/frontend-qt/nspb_qt/localization.py @@ -638,6 +638,8 @@ 'dep.fix.brewMissing': ('没装 Homebrew:从 brew.sh 安装(安装程序会要你的密码),再点「重新检测」。', 'Homebrew is not installed: install it from brew.sh (the installer asks for your password), then press Check again.', 'Homebrew är inte installerat. Installera från brew.sh. Installationsprogrammet ber om ditt lösenord. Välj sedan ”Kontrollera igen”.'), 'dep.fix.xcodeLicense': ('Xcode 的许可协议还没接受:运行 sudo xcodebuild -license accept。', "Xcode's license is not accepted yet: run sudo xcodebuild -license accept.", 'Xcodes licensavtal är inte godkänt. Kör sudo xcodebuild -license accept.'), 'dep.fix.network': ('下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。', "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again.", 'Hämtningen misslyckades. Kontrollera nätverket; proxy eller VPN kan blockera Homebrews domäner. Försök sedan igen.'), + 'dep.git.downloading': ('正在下载 PortableGit(SDK 下载需要它,约 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…'), + 'dep.git.done': ('PortableGit 已安装:%@', 'PortableGit installed: %@', 'PortableGit installed: %@'), 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\\\NSPB\\\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it.", "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it."), 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'dependency %@: [%@] %@'), 'dep.fix.diskspace': ('磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.'), diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift index 925e8ebe2..0f847b4ab 100644 --- a/frontend/Sources/NSPortBuilder/Localization.swift +++ b/frontend/Sources/NSPortBuilder/Localization.swift @@ -739,6 +739,8 @@ enum L10n { "Xcode's license is not accepted yet: run sudo xcodebuild -license accept."), "dep.fix.network": ("下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。", "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again."), + "dep.git.downloading": ("正在下载 PortableGit(SDK 下载需要它,约 45 MB)…", "Downloading PortableGit (the SDK download needs it, about 45 MB)…"), + "dep.git.done": ("PortableGit 已安装:%@", "PortableGit installed: %@"), "dep.fix.nonascii": ("SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\NSPB\\sdk),然后在依赖面板用「选择文件夹…」指向它。", "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\NSPB\\sdk) and point the dependencies panel's Choose folder… at it."), "dep.row.log": ("依赖 %@:[%@] %@", "dependency %@: [%@] %@"), From 2ddf2ed55911404bf057de24454a6d35303e5036 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 03:06:41 +0800 Subject: [PATCH 05/13] Tests: the wheels-args checks run without PySide6, as the CI job does --- frontend-qt/tests/test_win.py | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.py index 5f09bc4be..a1fe4c734 100644 --- a/frontend-qt/tests/test_win.py +++ b/frontend-qt/tests/test_win.py @@ -1710,14 +1710,32 @@ class VenvWheelsTest(unittest.TestCase): """The build packages ride in the zip: the venv installs offline from wheels/ beside the exe when it is there, and from PyPI exactly as before when it is not (source runs).""" + @staticmethod + def _pip_args_fn(): + """model.py imports PySide6, which the CI test job deliberately does not install: run + the pure static function by extracting it from the source when Qt is absent.""" + try: + from nspb_qt import model as M + return M.Model._pip_args + except ImportError: + import ast + src = (QT / 'nspb_qt' / 'model.py').read_text() + tree = ast.parse(src) + fn = next(n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef) + and n.name == '_pip_args') + for n in ast.walk(fn): + ast.fix_missing_locations(n) + ns: dict = {} + exec(compile(ast.fix_missing_locations(ast.Module(body=[fn], type_ignores=[])), + '', 'exec'), ns) + return ns['_pip_args'] + def test_offline_args_when_wheels_are_bundled(self) -> None: - from nspb_qt import model as M - args = M.Model._pip_args(['lz4', 'nsz'], Path('C:/app/wheels')) + args = self._pip_args_fn()(['lz4', 'nsz'], Path('C:/app/wheels')) self.assertEqual(args, ['install', '--no-index', '--find-links', 'C:/app/wheels', 'lz4', 'nsz']) def test_pypi_args_when_not_bundled(self) -> None: - from nspb_qt import model as M - self.assertEqual(M.Model._pip_args(['lz4'], None), ['install', 'lz4']) + self.assertEqual(self._pip_args_fn()(['lz4'], None), ['install', 'lz4']) def test_the_log_row_string_takes_three_args(self) -> None: from nspb_qt.i18n import Lang From f5aaf48ca62fa4e9db521868b724230be83314a5 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 04:13:41 +0800 Subject: [PATCH 06/13] =?UTF-8?q?Windows:=20the=20link=20probe=20now=20say?= =?UTF-8?q?s=20why=20libc=20is=20undefined=20=E2=80=94=20and=20one=20strat?= =?UTF-8?q?egy=20may=20just=20fix=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The owner's machine finally produced a readable failure, and it names the real problem: "ld64.lld: error: undefined symbol: puts" across all three strategies, with the linker's self-check green. That is libc not resolving — nothing to do with Metal (reinstalling it was a red herring). Two candidate causes, now both covered: - The SDK lacks its link stubs (usr/lib/libSystem.tbd, crt*.o): the probe checks both before linking and fails with "the download is incomplete — re-download or use the xip route" instead of an undefined-symbol list. The repo's iPhoneOS26.0.sdk does carry usr/lib/libSystem.tbd, so a partial checkout would read exactly like this. - The cross driver does not add -lSystem the way Apple's does: the probe gained a fourth strategy passing it explicitly, and build_app.link (the real build) now passes -lSystem too — idempotent when the driver already does it, decisive when it does not. And when all four fail, the summary appends a -v re-run of the first strategy, keeping the driver's link command, the runtime libs and the library search paths (12 lines) — so the next report shows whether -lSystem was passed and what the search paths were. Verified: python3 -m unittest discover -s frontend-qt/tests -> 175 tests, 9 skipped, 0 failures. --- frontend-qt/nspb_qt/win/build_app.py | 2 +- frontend-qt/nspb_qt/win/toolchain.py | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/frontend-qt/nspb_qt/win/build_app.py b/frontend-qt/nspb_qt/win/build_app.py index 6dbacdd50..fabdc1a5a 100644 --- a/frontend-qt/nspb_qt/win/build_app.py +++ b/frontend-qt/nspb_qt/win/build_app.py @@ -306,7 +306,7 @@ def link(clang: Path, sdk: Path, objs: list[Path], frameworks: list[str], out: P """Link the app, then prove the result is an unsigned iOS executable.""" args = [str(clang), '-target', f'arm64-apple-ios{deployment}', '-isysroot', str(sdk), '-fuse-ld=lld', '-fobjc-arc', '-o', str(out), *map(str, objs), - '-Wl,-rpath,@executable_path/Frameworks', '-lobjc', + '-Wl,-rpath,@executable_path/Frameworks', '-lobjc', '-lSystem', *[x for fw in frameworks for x in ('-framework', fw)], *embed_flags] if rt_obj: args.append(str(rt_obj)) diff --git a/frontend-qt/nspb_qt/win/toolchain.py b/frontend-qt/nspb_qt/win/toolchain.py index 9bdee0f52..464b3e98c 100644 --- a/frontend-qt/nspb_qt/win/toolchain.py +++ b/frontend-qt/nspb_qt/win/toolchain.py @@ -948,7 +948,8 @@ def link_attempt_summary(r: subprocess.CompletedProcess) -> str: def link_failure_summary(attempts: list[tuple[str, str, list[str]]], lld_line: str, - base: list[str], sdk: Path) -> str: + base: list[str], sdk: Path, + verbose: list[str] | None = None) -> str: """Every failed strategy, the linker's self-check, the exact command to try by hand, and — when the SDK lives under a non-ASCII path — the one hint that has fixed this exact shape before: ld64.lld's Windows port can fail to open narrow-char paths silently, while clang's @@ -962,6 +963,8 @@ def link_failure_summary(attempts: list[tuple[str, str, list[str]]], lld_line: s str(sdk).encode('ascii') except UnicodeEncodeError: parts.append('dep.fix.nonascii') + if verbose: + parts.append('verbose: ' + ' | '.join(verbose)) return ' — '.join(parts) @@ -1005,7 +1008,10 @@ def probe_link(sdk: Path) -> tuple[bool, str]: for how, extra, env in ( ('fuse-ld (build-style)', ['-fuse-ld=lld'], None), ('ld-path', ['-fuse-ld=lld', f'--ld-path={lld}'], None), - ('-B dir', [f'-B{lld.parent}', '-fuse-ld=lld'], None)): + ('-B dir', [f'-B{lld.parent}', '-fuse-ld=lld'], None), + # Apple's driver adds libSystem itself; a cross driver that does not leaves + # every libc symbol undefined (the report: puts). Name it explicitly. + ('explicit -lSystem', ['-fuse-ld=lld', '-lSystem'], None)): run_env = dict(os.environ) # a child on Windows needs the full env (SystemRoot etc.) if extra[:1] == ['-fuse-ld=lld'] and how.startswith('fuse-ld'): run_env['PATH'] = str(lld.parent) + os.pathsep + run_env.get('PATH', '') @@ -1017,7 +1023,17 @@ def probe_link(sdk: Path) -> tuple[bool, str]: break attempts.append((how, link_attempt_summary(r), cmd)) else: - return False, link_failure_summary(attempts, lld_line, base, sdk) + # One more run, verbose: the driver's own link command, the runtime libs it adds + # (-lSystem, crt) and the library search paths — the three things that decide whether + # libc (puts) resolves. Capped, since -v prints hundreds of lines. + rv = subprocess.run([*base, '-fuse-ld=lld', '-v', '-o', str(out), str(c)], + capture_output=True, text=True, timeout=180, + env=dict(os.environ), **no_window()) + interesting = [l.strip() for l in (rv.stderr or rv.stdout or '').splitlines() + if any(k in l for k in ('-lSystem', 'crt', 'Library search', + 'ld64.lld', 'error'))][:12] + return False, link_failure_summary(attempts, lld_line, base, sdk, + verbose=interesting) try: data = out.read_bytes() except OSError as e: From ba4eec73333ebfebfdea5394716a84ee58b9475b Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Fri, 30 Oct 2026 04:25:03 +0800 Subject: [PATCH 07/13] Windows: the link probe checks the SDK's link stubs before linking --- frontend-qt/nspb_qt/win/toolchain.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend-qt/nspb_qt/win/toolchain.py b/frontend-qt/nspb_qt/win/toolchain.py index 464b3e98c..3e5b0f6e1 100644 --- a/frontend-qt/nspb_qt/win/toolchain.py +++ b/frontend-qt/nspb_qt/win/toolchain.py @@ -991,6 +991,16 @@ def probe_link(sdk: Path) -> tuple[bool, str]: if v.returncode != 0: return False, (f'{lld.name} does not run by itself (exit {v.returncode}): {lld_line[:200]}' ' — reinstall LLVM-MinGW') + # The link needs two things from the SDK that a hollow or partial download lacks; their + # absence reads as "undefined symbol: puts" (libc) at link time while the COMPILE probe + # stays green (it needs headers only). Name them before blaming the linker. + missing = [n for n, there in ( + ('usr/lib/libSystem.tbd', (sdk / 'usr' / 'lib' / 'libSystem.tbd').is_file()), + ('usr/lib/crt*.o', any((sdk / 'usr' / 'lib').glob('crt*.o'))), + ) if not there] + if missing: + return False, (f'SDK is missing {", ".join(missing)}: the download is incomplete — ' + 're-download the SDK in the app, or use the xip route (doctor --sdk-xip)') src = '#include \nint main(void) { puts("probe"); return 0; }\n' with ascii_temp_dir('nspb-link-') as td: From c8e45668b23fd5a4f4e11a2647ec776b2cb7517e Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:08:01 +0800 Subject: [PATCH 08/13] =?UTF-8?q?Windows:=20the=20SDK=20check=20keeps=20li?= =?UTF-8?q?bSystem.tbd=20only=20=E2=80=94=20a=20real=20iOS=20SDK=20ships?= =?UTF-8?q?=20no=20crt*.o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit iOS executables use LC_MAIN, so even a complete iPhoneOS SDK has no crt object in usr/lib; checking for one rejected every player's correct download before the probe could link (review, v0lumehi). --- frontend-qt/nspb_qt/win/toolchain.py | 22 ++++++++++++---------- frontend-qt/tests/test_win.py | 13 +++++++++---- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/frontend-qt/nspb_qt/win/toolchain.py b/frontend-qt/nspb_qt/win/toolchain.py index 3e5b0f6e1..a7e650ac1 100644 --- a/frontend-qt/nspb_qt/win/toolchain.py +++ b/frontend-qt/nspb_qt/win/toolchain.py @@ -949,11 +949,13 @@ def link_attempt_summary(r: subprocess.CompletedProcess) -> str: def link_failure_summary(attempts: list[tuple[str, str, list[str]]], lld_line: str, base: list[str], sdk: Path, - verbose: list[str] | None = None) -> str: + verbose: list[str] | None = None, + t=None) -> str: """Every failed strategy, the linker's self-check, the exact command to try by hand, and — when the SDK lives under a non-ASCII path — the one hint that has fixed this exact shape before: ld64.lld's Windows port can fail to open narrow-char paths silently, while clang's - front end (the compile probe) handles them fine. + front end (the compile probe) handles them fine. `t` is the model's translator: the hint is + a localization key and must reach the panel translated, not as a raw key. """ parts = [f'link failed {len(attempts)} ways; ld64.lld self-check: {lld_line[:140]}'] for how, summary, _cmd in attempts: @@ -962,13 +964,13 @@ def link_failure_summary(attempts: list[tuple[str, str, list[str]]], lld_line: s try: str(sdk).encode('ascii') except UnicodeEncodeError: - parts.append('dep.fix.nonascii') + if t: parts.append(t('dep.fix.nonascii')) if verbose: parts.append('verbose: ' + ' | '.join(verbose)) return ' — '.join(parts) -def probe_link(sdk: Path) -> tuple[bool, str]: +def probe_link(sdk: Path, t=None) -> tuple[bool, str]: """Link a tiny executable for iOS and check it is an arm64 MH_EXECUTE with an iOS platform. Only the linker and the SDK's stubs are exercised, not the game's own code: an undefined @@ -991,12 +993,12 @@ def probe_link(sdk: Path) -> tuple[bool, str]: if v.returncode != 0: return False, (f'{lld.name} does not run by itself (exit {v.returncode}): {lld_line[:200]}' ' — reinstall LLVM-MinGW') - # The link needs two things from the SDK that a hollow or partial download lacks; their + # The link needs libSystem's stub from the SDK that a hollow or partial download lacks; its # absence reads as "undefined symbol: puts" (libc) at link time while the COMPILE probe - # stays green (it needs headers only). Name them before blaming the linker. + # stays green (it needs headers only). Name it before blaming the linker. iOS executables + # use LC_MAIN, so a real SDK ships no crt*.o at all — checking for one rejected complete SDKs. missing = [n for n, there in ( ('usr/lib/libSystem.tbd', (sdk / 'usr' / 'lib' / 'libSystem.tbd').is_file()), - ('usr/lib/crt*.o', any((sdk / 'usr' / 'lib').glob('crt*.o'))), ) if not there] if missing: return False, (f'SDK is missing {", ".join(missing)}: the download is incomplete — ' @@ -1043,7 +1045,7 @@ def probe_link(sdk: Path) -> tuple[bool, str]: if any(k in l for k in ('-lSystem', 'crt', 'Library search', 'ld64.lld', 'error'))][:12] return False, link_failure_summary(attempts, lld_line, base, sdk, - verbose=interesting) + verbose=interesting, t=t) try: data = out.read_bytes() except OSError as e: @@ -1086,7 +1088,7 @@ def macho_platform(data: bytes) -> int | None: # ---------------------------------------------------------------- the whole picture -def check_all(deep: bool = False) -> list[Probe]: +def check_all(deep: bool = False, t=None) -> list[Probe]: """Every component, in the order the dependency panel shows them. `deep` adds the compile / link / Metal probes. They take a few seconds, so the panel runs @@ -1203,7 +1205,7 @@ def check_all(deep: bool = False) -> list[Probe]: # compiler); this one adds the SDK to the same probe shape the build uses ok, detail = probe_compile(sdk, clang) out.append(Probe('probe_compile', 'cross-compile probe', 'ok' if ok else 'wrong', detail)) - ok2, detail2 = probe_link(sdk) + ok2, detail2 = probe_link(sdk, t=t) out.append(Probe('probe_link', 'cross-link probe', 'ok' if ok2 else 'wrong', detail2)) if sdk and metal_ok: ok3, detail3 = probe_metal(sdk) diff --git a/frontend-qt/tests/test_win.py b/frontend-qt/tests/test_win.py index a1fe4c734..f41338fd5 100644 --- a/frontend-qt/tests/test_win.py +++ b/frontend-qt/tests/test_win.py @@ -1695,15 +1695,20 @@ def test_the_failure_summary_names_everything_and_flags_a_non_ascii_sdk(self) -> ('ld-path', 'exit 1 (0x00000001): (no output)', ['clang', '--ld-path=x']), ('-B dir', 'exit 1 (0x00000001): (no output)', ['clang', '-Bx'])] plain = Path('C:/sdks/iPhoneOS26.0.sdk') - summary = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], plain) + t = lambda key, *a: 'HINT:' + key # the model's translator, as ui.py receives it + summary = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], plain, t=t) for part in ('link failed 3 ways', 'LLD 23.1.4', 'fuse-ld:', 'ld-path:', '-B dir:', 'try by hand:'): self.assertIn(part, summary, part) self.assertNotIn('dep.fix.nonascii', summary) - # The owner's machine: C:\Users\QC-北\... — the SDK itself sits under a non-ASCII path + # The owner's machine: C:\Users\QC-北\... — the SDK itself sits under a non-ASCII path. + # The hint is a localization key: the panel must see it translated, never as the raw key. nonascii = Path('C:/Users/QC-北/AppData/Local/NS Port Builder/sdks/iPhoneOS26.0.sdk') - hinted = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], nonascii) - self.assertIn('dep.fix.nonascii', hinted) + hinted = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], nonascii, t=t) + self.assertIn('HINT:dep.fix.nonascii', hinted) + self.assertNotIn(' — dep.fix.nonascii', hinted) + bare = tc.link_failure_summary(attempts, 'LLD 23.1.4', ['clang'], nonascii) + self.assertNotIn('dep.fix.nonascii', bare) class VenvWheelsTest(unittest.TestCase): From 802f1b9a26ea07716b3fdcfc9eb4a0c7f97f80d0 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:08:01 +0800 Subject: [PATCH 09/13] Windows: the link failure's non-ASCII hint reaches the panel translated link_failure_summary embedded the raw dep.fix.nonascii key in its joined text, which ui.py never translates (it only translates a detail that starts with the key). The model's translator now rides the probe call, and the test asserts the translated hint. --- frontend-qt/nspb_qt/model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend-qt/nspb_qt/model.py b/frontend-qt/nspb_qt/model.py index e8c1cba62..3be87ae89 100644 --- a/frontend-qt/nspb_qt/model.py +++ b/frontend-qt/nspb_qt/model.py @@ -353,7 +353,7 @@ def _windows_deps(self, deps: list[Dep]) -> list[Dep]: from .win import toolchain as wtc # local import: macOS never loads it out: list[Dep] = [] - probes = wtc.check_all(deep=True) + probes = wtc.check_all(deep=True, t=self.t) # t: the failure summaries' hint keys reach the panel translated # Re-do the Python row now that the toolchain can speak: the interpreter this app # installed for itself is not on PATH and not in Program Files, so the row built before From 997f0b1ce589242b570564b2d133a76708612a19 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:08:01 +0800 Subject: [PATCH 10/13] Windows: the venv wheels download pins exact versions and takes wheels only The zip ships these packages to players; the supply is now pinned (lz4 4.4.5, capstone 5.0.9, fonttools 4.68.0, backports.zstd 1.8.0, nsz 5.0.0) and sdists are out. --- .github/workflows/build-qt.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index 7ef50981a..38e74a9d3 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -42,8 +42,10 @@ jobs: # so a fresh machine needs no PyPI round-trip for lz4/capstone/fonttools/nsz. The runner's # Python is the version these wheels target (3.12), matching the interpreter the app # installs for its venv. + # Exact versions, wheels only: the zip ships these to players, so the supply is pinned + # (hash-locking the full closure can follow the Mac bundled-Python pattern if wanted). - name: Download the venv wheels - run: python -m pip download lz4 capstone fonttools backports.zstd nsz -d frontend-qt/wheels + run: python -m pip download --only-binary=:all: lz4==4.4.5 capstone==5.0.9 fonttools==4.68.0 backports.zstd==1.8.0 nsz==5.0.0 -d frontend-qt/wheels - name: Build working-directory: frontend-qt From 93e1138255d6cb602e8c08985cc1e18378b1f8b8 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:08:01 +0800 Subject: [PATCH 11/13] Swedish for the nine new dependency strings, language table regenerated --- frontend-qt/nspb_qt/localization.py | 18 +++++++++--------- .../Sources/NSPortBuilder/Localization.swift | 9 +++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py index 440b0c5a9..9c43805ee 100644 --- a/frontend-qt/nspb_qt/localization.py +++ b/frontend-qt/nspb_qt/localization.py @@ -611,11 +611,11 @@ 'dep.show': ('展开', 'Show', 'Show'), 'dep.pick': ('选择文件夹…', 'Choose folder…', 'Choose folder…'), 'dep.pick.ios_sdk.title': ('选择 iPhoneOS SDK 文件夹', 'Choose the iPhoneOS SDK folder', 'Choose the iPhoneOS SDK folder'), - 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)'), - 'dep.pick.metal': ('选择 zip / 文件夹…', 'Choose zip / folder…', 'Choose zip / folder…'), - 'dep.metal.unpacking': ('正在解压 %@…', 'Unpacking %@…', 'Unpacking %@…'), - 'dep.metal.done': ('Metal Developer Tools 已安装:%@', 'Metal Developer Tools installed: %@', 'Metal Developer Tools installed: %@'), - 'dep.pick.metal.invalid': ('“%@”里没有 metal.exe(需要 bin\\\\metal.exe 或 ios\\\\bin\\\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。', 'No metal.exe inside "%@" (needs bin\\\\metal.exe or ios\\\\bin\\\\metal.exe): check that the download is "Metal Developer Tools for Windows".', 'No metal.exe inside "%@" (needs bin\\\\metal.exe or ios\\\\bin\\\\metal.exe): check that the download is "Metal Developer Tools for Windows".'), + 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)', 'Välj Metal Developer Tools (den nedladdade zip-filen eller den uppackade mappen)'), + 'dep.pick.metal': ('选择 zip / 文件夹…', 'Choose zip / folder…', 'Välj zip / mapp …'), + 'dep.metal.unpacking': ('正在解压 %@…', 'Unpacking %@…', 'Packar upp %@ …'), + 'dep.metal.done': ('Metal Developer Tools 已安装:%@', 'Metal Developer Tools installed: %@', 'Metal Developer Tools installerat: %@'), + 'dep.pick.metal.invalid': ('“%@”里没有 metal.exe(需要 bin\\\\metal.exe 或 ios\\\\bin\\\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。', 'No metal.exe inside "%@" (needs bin\\\\metal.exe or ios\\\\bin\\\\metal.exe): check that the download is "Metal Developer Tools for Windows".', 'Ingen metal.exe i ”%@” (kräver bin\\\\metal.exe eller ios\\\\bin\\\\metal.exe): kontrollera att nedladdningen är ”Metal Developer Tools for Windows”.'), 'dep.pick.saved': ('已记住:%@', 'Remembered: %@', 'Remembered: %@'), 'dep.pick.iossdk.saved': ('SDK 已记住:%@', 'SDK remembered: %@', 'SDK remembered: %@'), 'dep.pick.iossdk.version': ('SDK 版本:%@', 'SDK version: %@', 'SDK version: %@'), @@ -638,10 +638,10 @@ 'dep.fix.brewMissing': ('没装 Homebrew:从 brew.sh 安装(安装程序会要你的密码),再点「重新检测」。', 'Homebrew is not installed: install it from brew.sh (the installer asks for your password), then press Check again.', 'Homebrew är inte installerat. Installera från brew.sh. Installationsprogrammet ber om ditt lösenord. Välj sedan ”Kontrollera igen”.'), 'dep.fix.xcodeLicense': ('Xcode 的许可协议还没接受:运行 sudo xcodebuild -license accept。', "Xcode's license is not accepted yet: run sudo xcodebuild -license accept.", 'Xcodes licensavtal är inte godkänt. Kör sudo xcodebuild -license accept.'), 'dep.fix.network': ('下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。', "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again.", 'Hämtningen misslyckades. Kontrollera nätverket; proxy eller VPN kan blockera Homebrews domäner. Försök sedan igen.'), - 'dep.git.downloading': ('正在下载 PortableGit(SDK 下载需要它,约 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…'), - 'dep.git.done': ('PortableGit 已安装:%@', 'PortableGit installed: %@', 'PortableGit installed: %@'), - 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\\\NSPB\\\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it.", "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it."), - 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'dependency %@: [%@] %@'), + 'dep.git.downloading': ('正在下载 PortableGit(SDK 下载需要它,约 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…', 'Hämtar PortableGit (SDK-nedladdningen behöver den, cirka 45 MB) …'), + 'dep.git.done': ('PortableGit 已安装:%@', 'PortableGit installed: %@', 'PortableGit installerat: %@'), + 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\\\NSPB\\\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\\\NSPB\\\\sdk) and point the dependencies panel's Choose folder… at it.", 'SDK-sökvägen innehåller icke-ASCII-tecken (ett kinesiskt användarnamn till exempel): ld64.lld på Windows kan därför misslyckas med att öppna SDK-filerna. Kopiera hela SDK-mappen till en sökväg med bara ASCII (till exempel C:\\\\NSPB\\\\sdk) och peka beroendepanelens ”Välj mapp …” på den.'), + 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'beroende %@: [%@] %@'), 'dep.fix.diskspace': ('磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.'), 'dep.fix.log': ('完整输出在 Mac/iPhone 选择下面的日志里。', 'The full output is in the log under the Mac/iPhone choice.', 'Fullständig utdata finns i loggen under Mac/iPhone-valet.'), 'dep.python.missing': ('%@ 缺包', '%@ is missing packages', '%@ saknar paket'), diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift index 0f847b4ab..ce0feb9ba 100644 --- a/frontend/Sources/NSPortBuilder/Localization.swift +++ b/frontend/Sources/NSPortBuilder/Localization.swift @@ -1576,6 +1576,15 @@ enum L10n { "msg.workdirHint": "Tips: ”Utdatamapp” är också platsen för byggcachen (utdatamapp/_build). Välj samma plats som förra bygget för att återanvända befintliga byggresurser, så körs inte uppackning och shaders igen. En ny plats börjar från början.", "msg.chainChanged": "Uppströmskoden uppdaterade kedjan för shaderöversättning. Tidigare shaderbibliotek kan inte återanvändas. Det här bygget återskapar dem med den nya översättaren, vilket bara sker en gång per version.", "dep.python.downloading": "Hämtar och installerar Python 3.12 … ungefär 26 MB, till appens egen mapp", + "dep.pick.metal_dir.title": "Välj Metal Developer Tools (den nedladdade zip-filen eller den uppackade mappen)", + "dep.pick.metal": "Välj zip / mapp …", + "dep.metal.unpacking": "Packar upp %@ …", + "dep.metal.done": "Metal Developer Tools installerat: %@", + "dep.pick.metal.invalid": "Ingen metal.exe i ”%@” (kräver bin\\metal.exe eller ios\\bin\\metal.exe): kontrollera att nedladdningen är ”Metal Developer Tools for Windows”.", + "dep.git.downloading": "Hämtar PortableGit (SDK-nedladdningen behöver den, cirka 45 MB) …", + "dep.git.done": "PortableGit installerat: %@", + "dep.fix.nonascii": "SDK-sökvägen innehåller icke-ASCII-tecken (ett kinesiskt användarnamn till exempel): ld64.lld på Windows kan därför misslyckas med att öppna SDK-filerna. Kopiera hela SDK-mappen till en sökväg med bara ASCII (till exempel C:\\NSPB\\sdk) och peka beroendepanelens ”Välj mapp …” på den.", + "dep.row.log": "beroende %@: [%@] %@", "prog.empty": "När bygget startar visas varje steg från skriptet här", "install.step2": "2\tKopiera hela romfs-mappen ovan till spelappens Dokument (appen Filer → På min iPhone → spelets namn)", "msg.installingNsz": "Det valda filformatet är komprimerat NSZ/XCZ. Installerar nsz i Python-miljön som används för bygget …", From 6c4b0b2f19fa45d27b60f8021ade398995b95f19 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:11:13 +0800 Subject: [PATCH 12/13] =?UTF-8?q?CI:=20quote=20the=20wheels=20command=20?= =?UTF-8?q?=E2=80=94=20the=20:all:=20colon=20broke=20the=20YAML?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-qt.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-qt.yml b/.github/workflows/build-qt.yml index 38e74a9d3..7b367491d 100644 --- a/.github/workflows/build-qt.yml +++ b/.github/workflows/build-qt.yml @@ -45,7 +45,7 @@ jobs: # Exact versions, wheels only: the zip ships these to players, so the supply is pinned # (hash-locking the full closure can follow the Mac bundled-Python pattern if wanted). - name: Download the venv wheels - run: python -m pip download --only-binary=:all: lz4==4.4.5 capstone==5.0.9 fonttools==4.68.0 backports.zstd==1.8.0 nsz==5.0.0 -d frontend-qt/wheels + run: "python -m pip download --only-binary=:all: lz4==4.4.5 capstone==5.0.9 fonttools==4.68.0 backports.zstd==1.8.0 nsz==5.0.0 -d frontend-qt/wheels" - name: Build working-directory: frontend-qt From 630edaa30e97a0d990d3dc04370b3614a41a8b98 Mon Sep 17 00:00:00 2001 From: LNPANDY Date: Sat, 31 Oct 2026 23:35:32 +0800 Subject: [PATCH 13/13] German for the new dependency strings, language table regenerated --- frontend-qt/nspb_qt/localization.py | 18 +++++++++--------- .../Sources/NSPortBuilder/Localization.swift | 9 +++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend-qt/nspb_qt/localization.py b/frontend-qt/nspb_qt/localization.py index 4b5c70a0b..eb9c96073 100644 --- a/frontend-qt/nspb_qt/localization.py +++ b/frontend-qt/nspb_qt/localization.py @@ -684,11 +684,11 @@ 'dep.show': ('展开', 'Show', 'Show', 'Einblenden'), 'dep.pick': ('选择文件夹…', 'Choose folder…', 'Choose folder…', 'Ordner wählen …'), 'dep.pick.ios_sdk.title': ('选择 iPhoneOS SDK 文件夹', 'Choose the iPhoneOS SDK folder', 'Choose the iPhoneOS SDK folder', 'Ordner des iPhoneOS SDK wählen'), - 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)', 'Välj Metal Developer Tools (den nedladdade zip-filen eller den uppackade mappen)', 'Ordner der Metal Developer Tools wählen'), - 'dep.pick.metal': ('选择 zip / 文件夹…', 'Choose zip / folder…', 'Välj zip / mapp …', 'Choose zip / folder…'), - 'dep.metal.unpacking': ('正在解压 %@…', 'Unpacking %@…', 'Packar upp %@ …', 'Unpacking %@…'), - 'dep.metal.done': ('Metal Developer Tools 已安装:%@', 'Metal Developer Tools installed: %@', 'Metal Developer Tools installerat: %@', 'Metal Developer Tools installed: %@'), - 'dep.pick.metal.invalid': ('“%@”里没有 metal.exe(需要 bin\\metal.exe 或 ios\\bin\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。', 'No metal.exe inside "%@" (needs bin\\metal.exe or ios\\bin\\metal.exe): check that the download is "Metal Developer Tools for Windows".', 'Ingen metal.exe i ”%@” (kräver bin\\metal.exe eller ios\\bin\\metal.exe): kontrollera att nedladdningen är ”Metal Developer Tools for Windows”.', 'No metal.exe inside "%@" (needs bin\\metal.exe or ios\\bin\\metal.exe): check that the download is "Metal Developer Tools for Windows".'), + 'dep.pick.metal_dir.title': ('选择 Metal Developer Tools(下载的 zip 或解压后的文件夹)', 'Choose Metal Developer Tools (the downloaded zip, or the unpacked folder)', 'Välj Metal Developer Tools (den nedladdade zip-filen eller den uppackade mappen)', 'Metal Developer Tools wählen (die geladene Zip oder der entpackte Ordner)'), + 'dep.pick.metal': ('选择 zip / 文件夹…', 'Choose zip / folder…', 'Välj zip / mapp …', 'Zip / Ordner wählen …'), + 'dep.metal.unpacking': ('正在解压 %@…', 'Unpacking %@…', 'Packar upp %@ …', '%@ wird entpackt …'), + 'dep.metal.done': ('Metal Developer Tools 已安装:%@', 'Metal Developer Tools installed: %@', 'Metal Developer Tools installerat: %@', 'Metal Developer Tools installiert: %@'), + 'dep.pick.metal.invalid': ('“%@”里没有 metal.exe(需要 bin\\metal.exe 或 ios\\bin\\metal.exe):确认下载的是 “Metal Developer Tools for Windows”。', 'No metal.exe inside "%@" (needs bin\\metal.exe or ios\\bin\\metal.exe): check that the download is "Metal Developer Tools for Windows".', 'Ingen metal.exe i ”%@” (kräver bin\\metal.exe eller ios\\bin\\metal.exe): kontrollera att nedladdningen är ”Metal Developer Tools for Windows”.', 'Keine metal.exe in „%@“ (benötigt bin\\metal.exe oder ios\\bin\\metal.exe): Prüfe, ob der Download „Metal Developer Tools for Windows“ ist.'), 'dep.pick.saved': ('已记住:%@', 'Remembered: %@', 'Remembered: %@', 'Gemerkt: %@'), 'dep.pick.iossdk.saved': ('SDK 已记住:%@', 'SDK remembered: %@', 'SDK remembered: %@', 'SDK gemerkt: %@'), 'dep.pick.iossdk.version': ('SDK 版本:%@', 'SDK version: %@', 'SDK version: %@', 'SDK-Version: %@'), @@ -711,10 +711,10 @@ 'dep.fix.brewMissing': ('没装 Homebrew:从 brew.sh 安装(安装程序会要你的密码),再点「重新检测」。', 'Homebrew is not installed: install it from brew.sh (the installer asks for your password), then press Check again.', 'Homebrew är inte installerat. Installera från brew.sh. Installationsprogrammet ber om ditt lösenord. Välj sedan ”Kontrollera igen”.', 'Homebrew ist nicht installiert: Installiere es von brew.sh (das Installationsprogramm fragt nach deinem Passwort) und tippe dann auf „Erneut prüfen“.'), 'dep.fix.xcodeLicense': ('Xcode 的许可协议还没接受:运行 sudo xcodebuild -license accept。', "Xcode's license is not accepted yet: run sudo xcodebuild -license accept.", 'Xcodes licensavtal är inte godkänt. Kör sudo xcodebuild -license accept.', 'Die Lizenz von Xcode ist noch nicht akzeptiert: Führe sudo xcodebuild -license accept aus.'), 'dep.fix.network': ('下载失败了:检查网络(代理或 VPN 可能拦住了 Homebrew 的域名),再试一次。', "The download failed: check the network (a proxy or VPN can block Homebrew's hosts) and try again.", 'Hämtningen misslyckades. Kontrollera nätverket; proxy eller VPN kan blockera Homebrews domäner. Försök sedan igen.', 'Der Download ist fehlgeschlagen: Prüfe das Netzwerk (ein Proxy oder VPN kann die Server von Homebrew blockieren) und versuche es erneut.'), - 'dep.git.downloading': ('正在下载 PortableGit(SDK 下载需要它,约 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…', 'Hämtar PortableGit (SDK-nedladdningen behöver den, cirka 45 MB) …', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…'), - 'dep.git.done': ('PortableGit 已安装:%@', 'PortableGit installed: %@', 'PortableGit installerat: %@', 'PortableGit installed: %@'), - 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\NSPB\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\NSPB\\sdk) and point the dependencies panel's Choose folder… at it.", 'SDK-sökvägen innehåller icke-ASCII-tecken (ett kinesiskt användarnamn till exempel): ld64.lld på Windows kan därför misslyckas med att öppna SDK-filerna. Kopiera hela SDK-mappen till en sökväg med bara ASCII (till exempel C:\\NSPB\\sdk) och peka beroendepanelens ”Välj mapp …” på den.', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\NSPB\\sdk) and point the dependencies panel's Choose folder… at it."), - 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'beroende %@: [%@] %@', 'dependency %@: [%@] %@'), + 'dep.git.downloading': ('正在下载 PortableGit(SDK 下载需要它,约 45 MB)…', 'Downloading PortableGit (the SDK download needs it, about 45 MB)…', 'Hämtar PortableGit (SDK-nedladdningen behöver den, cirka 45 MB) …', 'PortableGit wird geladen (die SDK-Installation braucht es, rund 45 MB) …'), + 'dep.git.done': ('PortableGit 已安装:%@', 'PortableGit installed: %@', 'PortableGit installerat: %@', 'PortableGit installiert: %@'), + 'dep.fix.nonascii': ('SDK 所在路径含非英文字符(比如用户名里的中文):ld64.lld 在 Windows 上可能因此打不开 SDK 文件。把整个 SDK 文件夹拷到一个纯英文路径(如 C:\\NSPB\\sdk),然后在依赖面板用「选择文件夹…」指向它。', "The SDK path contains non-ASCII characters (a Chinese username, for example): ld64.lld on Windows may fail to open it. Copy the whole SDK folder to an ASCII-only path (e.g. C:\\NSPB\\sdk) and point the dependencies panel's Choose folder… at it.", 'SDK-sökvägen innehåller icke-ASCII-tecken (ett kinesiskt användarnamn till exempel): ld64.lld på Windows kan därför misslyckas med att öppna SDK-filerna. Kopiera hela SDK-mappen till en sökväg med bara ASCII (till exempel C:\\NSPB\\sdk) och peka beroendepanelens ”Välj mapp …” på den.', 'Der SDK-Pfad enthält Nicht-ASCII-Zeichen (etwa ein chinesischer Benutzername): ld64.lld öffnet die SDK-Dateien unter Windows deshalb womöglich nicht. Kopiere den ganzen SDK-Ordner auf einen reinen ASCII-Pfad (z. B. C:\\NSPB\\sdk) und wähle ihn im Abhängigkeiten-Panel unter „Ordner wählen …“.'), + 'dep.row.log': ('依赖 %@:[%@] %@', 'dependency %@: [%@] %@', 'beroende %@: [%@] %@', 'Abhängigkeit %@: [%@] %@'), 'dep.fix.diskspace': ('磁盘空间不足:清理后(SDK 和工具链解压需要数 GB)再点「安装」。', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'The disk is full: free some space (the SDK and toolchains unpack to several GB) and press Install again.', 'Das Volume ist voll: Gib Speicherplatz frei (das SDK und die Toolchains entpacken sich auf mehrere GB) und tippe erneut auf „Installieren“.'), 'dep.fix.log': ('完整输出在 Mac/iPhone 选择下面的日志里。', 'The full output is in the log under the Mac/iPhone choice.', 'Fullständig utdata finns i loggen under Mac/iPhone-valet.', 'Die vollständige Ausgabe steht im Protokoll unter der Auswahl Mac/iPhone.'), 'dep.python.missing': ('%@ 缺包', '%@ is missing packages', '%@ saknar paket', 'Bei %@ fehlen Pakete'), diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift index 66ec24270..944074687 100644 --- a/frontend/Sources/NSPortBuilder/Localization.swift +++ b/frontend/Sources/NSPortBuilder/Localization.swift @@ -2621,6 +2621,15 @@ enum L10n { "fail.engineSync.next": "Tippe auf „Erneut versuchen“. Das Protokoll zeigt den Grund. Wenn es weiter fehlschlägt, melde es mit „Diagnose kopieren“ und dem Protokoll.", "dep.metal.other": "%@ (getestet: %@)", "dep.fix.metalPin": "Das ist nicht der Metal-Compiler, mit dem die Shader getestet wurden. Spiele mit NVN stoppen vor den Shader-Schritten. Installiere Xcode 27.1 (macOS 26.6 oder neuer) samt Metal-Toolchain.", + "dep.pick.metal_dir.title": "Metal Developer Tools wählen (die geladene Zip oder der entpackte Ordner)", + "dep.pick.metal": "Zip / Ordner wählen …", + "dep.metal.unpacking": "%@ wird entpackt …", + "dep.metal.done": "Metal Developer Tools installiert: %@", + "dep.pick.metal.invalid": "Keine metal.exe in „%@“ (benötigt bin\\metal.exe oder ios\\bin\\metal.exe): Prüfe, ob der Download „Metal Developer Tools for Windows“ ist.", + "dep.git.downloading": "PortableGit wird geladen (die SDK-Installation braucht es, rund 45 MB) …", + "dep.git.done": "PortableGit installiert: %@", + "dep.fix.nonascii": "Der SDK-Pfad enthält Nicht-ASCII-Zeichen (etwa ein chinesischer Benutzername): ld64.lld öffnet die SDK-Dateien unter Windows deshalb womöglich nicht. Kopiere den ganzen SDK-Ordner auf einen reinen ASCII-Pfad (z. B. C:\\NSPB\\sdk) und wähle ihn im Abhängigkeiten-Panel unter „Ordner wählen …“.", + "dep.row.log": "Abhängigkeit %@: [%@] %@", "msg.exitCode": "Exit-Code %d", "msg.stagingFailed": "Im Staging-Ordner konnten keine Links erstellt werden (Dateien auf verschiedenen Volumes?)", "msg.stagedFromSharedFolder": "Der Ordner enthält weitere Spiele: Es wird aus einer temporären Kopie dieses Spiels gebaut (%@)",