Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
fix(setup): drop an engine archive that fails to unpack
Sunil Srivatsa645cbb66e44b
diff --git a/setup.py b/setup.pyindex 968640950..a45d39e6e 100644--- a/setup.py+++ b/setup.py@@ -1991,8 +1991,12 @@ def get_prebuilt(url_base, gpu, vision, updating=False, toolkit=13) -> Path | Nodownload(base + asset, z, "Strata engine")tmp = eng / "_unpack"shutil.rmtree(tmp, ignore_errors=True)- with zipfile.ZipFile(z) as f:- f.extractall(tmp)+ try:+ with zipfile.ZipFile(z) as f:+ f.extractall(tmp)+ except zipfile.BadZipFile: # not a zip, or a damaged one: a kept .done mark would make+ drop_archive(z) # every later run fail on it instead of downloading it again+ raisemeta = json.loads((tmp / "BUILD.json").read_text())if tuple(int(x) for x in str(meta.get("version", "0")).split(".")[:3] if x.isdigit()) < MIN_ENGINE:need = ".".join(map(str, MIN_ENGINE))diff --git a/tools/test_setup_pins.py b/tools/test_setup_pins.pyindex c600f6927..8638fdcfe 100644--- a/tools/test_setup_pins.py+++ b/tools/test_setup_pins.py@@ -216,6 +216,21 @@ class Engine(unittest.TestCase):self.assertFalse(z.exists())self.assertFalse(z.with_name(z.name + ".done").exists())+ def test_an_archive_that_does_not_unpack_is_not_kept(self):+ """#397, for an archive that does not unpack (not a zip, or a damaged one): it kept its zip and .done mark,+ so every later run failed on it, even after the right one was published."""+ with tempfile.TemporaryDirectory() as folder: # a --prebuilt folder, through the real download()+ asset = Path(folder) / setup.PREBUILT_ASSET+ asset.write_bytes(b"<html>not a zip</html>")+ with self.assertRaises(zipfile.BadZipFile):+ quiet(setup.get_prebuilt, folder, {"arch": 89}, "gpu")+ with zipfile.ZipFile(asset, "w") as z:+ z.writestr("BUILD.json", json.dumps({"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [89]}))+ z.writestr(setup.EXE, b"engine")+ eng, _ = quiet(setup.get_prebuilt, folder, {"arch": 89}, "gpu")+ self.assertEqual(eng, self.root / "engine")+ self.assertEqual((self.root / "engine" / setup.EXE).read_bytes(), b"engine")+def test_an_installed_engine_is_kept(self):(self.root / "engine" / "BUILD.json").write_text(json.dumps({"version": ".".join(map(str, setup.MIN_ENGINE)), "archs": [89]}))