mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 06:29:58 -04:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user