From b72ea678be9babef34b1844ed41c067b8ef3e433 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Mon, 5 Oct 2026 10:04:21 +0200 Subject: [PATCH] sycl setup: write_run_script takes setup.py's open_browser argument; Arc Pro B60 also as PCI id e211 (#870) Fixes 1 and 4 of #870, plus a test that every function setup_intel.py swaps into setup.py accepts all of the original's parameters. Fixes 2 and 3 are PR #784's session/native_dense ports. Co-authored-by: Magh97 --- sycl/setup_intel.py | 4 ++-- tools/test_setup_sycl.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/sycl/setup_intel.py b/sycl/setup_intel.py index 9e615bc1..0174248e 100644 --- a/sycl/setup_intel.py +++ b/sycl/setup_intel.py @@ -209,11 +209,11 @@ def install(argv) -> None: write = S.write_run_script - def write_run_script(model, cfg_path, port): + def write_run_script(model, cfg_path, port, open_browser=True): # setup.write_run_script's signature (#870) cfg = json.loads(Path(cfg_path).read_text(encoding="utf-8")) cfg = to_sycl(cfg, exe, real_ram, keep.get(Path(cfg_path).name, {})) Path(cfg_path).write_text(json.dumps(cfg, indent=1), encoding="utf-8") - script = write(model, cfg_path, port) + script = write(model, cfg_path, port, open_browser) script.write_text(script.read_text().replace(str(ROOT / "serve" / "server.py"), str(SERVER))) return script S.write_run_script = write_run_script diff --git a/tools/test_setup_sycl.py b/tools/test_setup_sycl.py index 49badcab..ede0bed1 100644 --- a/tools/test_setup_sycl.py +++ b/tools/test_setup_sycl.py @@ -62,6 +62,41 @@ class SyclBackend(unittest.TestCase): for name in re.findall(r'"(\w+)"', names): self.assertTrue(callable(getattr(setup, name, None)), name) + def test_setup_intel_replacements_take_every_argument_of_the_function_they_replace(self): + """#870: setup.py grew write_run_script's fourth argument and the port's replacement still took three, so + setup died with a TypeError after the download. Every `S. = ` in setup_intel.py must accept + all the parameters of setup. (or take *args / **kwargs).""" + import ast + import inspect + tree = ast.parse((ROOT / "sycl" / "setup_intel.py").read_text(encoding="utf-8")) + defs = {n.name: n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef)} + checked = 0 + for n in ast.walk(tree): + if not (isinstance(n, ast.Assign) and len(n.targets) == 1 and isinstance(n.targets[0], ast.Attribute) + and isinstance(n.targets[0].value, ast.Name) and n.targets[0].value.id == "S"): + continue + name = n.targets[0].attr + fn = n.value if isinstance(n.value, ast.Lambda) else defs.get(getattr(n.value, "id", "")) + orig = getattr(setup, name, None) + if fn is None or not callable(orig): + continue + a = fn.args + if a.vararg is not None and a.kwarg is not None: + checked += 1 + continue + have = {x.arg for x in a.posonlyargs + a.args + a.kwonlyargs} + for param in inspect.signature(orig).parameters.values(): + if param.kind in (param.VAR_POSITIONAL, param.VAR_KEYWORD): + continue + self.assertIn(param.name, have, f"setup_intel's {name} lacks setup.{name}'s `{param.name}`") + checked += 1 + self.assertGreaterEqual(checked, 8) + + def test_arc_pro_b60_is_known_under_both_pci_ids(self): + src = (ROOT / "sycl" / "setup_intel.py").read_text(encoding="utf-8") + self.assertIn('"e211": ("Arc Pro B60", 24.0)', src) + self.assertIn('"e221": ("Arc Pro B60", 24.0)', src) + class CMakeOption(unittest.TestCase): def test_sycl_is_off_by_default_and_exclusive(self):