Check at startup that the launcher's Python can read zstd files, and say how to fix it when it cannot.

Run from a checkout, the launcher uses the Python that started it. A Python older than 3.14 without the zstandard
package got through the first-run screen and stopped at Gather Build Tools with only "No module named 'zstandard'",
after the packages were downloaded. toolchain.zstd_missing now looks for compression.zstd or zstandard when the
launcher starts. Without either, the log and the first screen name the Python and give the pip line for
tools/requirements-launcher.txt, and Gather Build Tools stops with the same message before it unpacks anything. A
release's own Python always has the package; if it ever lacks it, the message says to reinstall NX2navi.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-12 07:16:14 -05:00
parent ee46a19ede
commit d2ab9a00be
6 changed files with 48 additions and 0 deletions

View File

@@ -498,6 +498,19 @@ class UninstallTest(Tmp):
# ---------------------------------------------------------------- toolchain
class ToolchainTest(Tmp):
def test_zstd_missing(self):
"""A Python without compression.zstd and zstandard is named at startup, with the pip line for a checkout."""
with mock.patch.dict(sys.modules, {'compression.zstd': None, 'zstandard': mock.MagicMock()}):
self.assertEqual(toolchain.zstd_missing(self.layout), '')
with mock.patch.dict(sys.modules, {'compression.zstd': None, 'zstandard': None}):
msg = toolchain.zstd_missing(self.layout)
ctx = Context(self.layout)
self.assertIn('zstandard', msg)
self.assertIn('-m pip install -r', msg)
self.assertIn('requirements-launcher.txt', msg)
self.assertEqual(ctx.zstd_missing, msg)
self.assertTrue(any(msg in line for line in ctx.log_tail()))
def test_resolve_and_install(self):
repo = self.tmp / 'repo'
repo.mkdir()