zview-gui 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
zview_gui/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """ZView GUI: the browser UI for ZView and its local session adapter."""
2
+
3
+ from importlib import metadata
4
+
5
+ try:
6
+ __version__ = metadata.version("zview-gui")
7
+ except metadata.PackageNotFoundError: # a source checkout that is not installed
8
+ __version__ = "0+checkout"
zview_gui/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """``python -m zview_gui`` is the ``zview-gui`` command."""
2
+
3
+ from .cli import main
4
+
5
+ raise SystemExit(main())
@@ -0,0 +1,177 @@
1
+ """Resolve build context without opening a probe or changing an active session."""
2
+
3
+ import subprocess
4
+ from pathlib import Path
5
+
6
+ import yaml
7
+ from zview.runner_config import find_elf, image_dir
8
+ from zview.target import AVAILABLE_RUNNERS, Target
9
+
10
+ from .paths import input_path, local_path
11
+
12
+
13
+ def artifact(root, path):
14
+ """Validate generated artifacts too: a build can contain external symlinks."""
15
+ resolved = path.resolve()
16
+ if not resolved.is_relative_to(root):
17
+ raise ValueError("Build artifacts must stay inside the configured data root.")
18
+ if not resolved.exists():
19
+ return None
20
+ return input_path(root, str(resolved))[0]
21
+
22
+
23
+ def cache_values(path):
24
+ values = {}
25
+ if path:
26
+ for line in path.read_text().splitlines():
27
+ if "=" in line and not line.startswith(("#", "//")):
28
+ key, value = line.split("=", 1)
29
+ values[key.split(":", 1)[0]] = value
30
+ return values
31
+
32
+
33
+ def board_name(config, cache):
34
+ values = {}
35
+ if config:
36
+ for line in config.read_text().splitlines():
37
+ if line.startswith(("CONFIG_BOARD_TARGET=", "CONFIG_BOARD=")):
38
+ key, value = line.split("=", 1)
39
+ values[key] = value.strip('"')
40
+ return (
41
+ values.get("CONFIG_BOARD_TARGET")
42
+ or cache.get("BOARD")
43
+ or values.get("CONFIG_BOARD")
44
+ or None
45
+ )
46
+
47
+
48
+ def checkout_context(root, source):
49
+ """Current checkout only, never evidence of which commit produced an ELF."""
50
+ if not source:
51
+ return None, None
52
+ source_path = Path(source).resolve()
53
+ if not source_path.is_relative_to(root) or not source_path.is_dir():
54
+ return None, None
55
+
56
+ def git(*args):
57
+ return subprocess.check_output(
58
+ ["git", "--no-optional-locks", "-C", str(source_path), *args],
59
+ text=True, stderr=subprocess.DEVNULL, timeout=2,
60
+ ).strip()
61
+
62
+ try:
63
+ commit = git("rev-parse", "--verify", "HEAD")
64
+ branch = git("branch", "--show-current") or None
65
+ dirty = bool(git("status", "--porcelain", "--untracked-files=no", "--", "."))
66
+ return source_path.relative_to(root).as_posix(), {
67
+ "commit": commit, "branch": branch, "dirty": dirty,
68
+ "provenance": "current_checkout",
69
+ }
70
+ except (OSError, subprocess.SubprocessError):
71
+ return source_path.relative_to(root).as_posix(), None
72
+
73
+
74
+ def live_runner(path, warnings):
75
+ """Prefer the build's attach/debug runner, not its flashing command."""
76
+ if path is None:
77
+ return None
78
+ config = yaml.safe_load(path.read_text())
79
+ if not isinstance(config, dict):
80
+ raise ValueError("runners.yaml must contain a runner configuration.")
81
+ listed = config.get("runners", [])
82
+ if not isinstance(listed, list) or not all(isinstance(r, str) for r in listed):
83
+ raise ValueError("runners.yaml has an invalid runner list.")
84
+ debug = config.get("debug-runner")
85
+ if debug in AVAILABLE_RUNNERS:
86
+ return debug
87
+ if debug:
88
+ warnings.append(f"Build debug runner '{debug}' is not supported by ZView.")
89
+ flash = config.get("flash-runner")
90
+ if flash in {"jlink", "pyocd", "gdb"}:
91
+ return flash
92
+ # A persistent probe backend avoids starting a flashing-tool subprocess for
93
+ # every memory read. Keep the build's ordering among its supported choices.
94
+ detected = next((runner for runner in listed if runner in {"jlink", "pyocd"}), None)
95
+ if detected is not None:
96
+ warnings.append(f"Using build-configured '{detected}' for Live reads instead of flash runner '{flash}'.")
97
+ return detected
98
+
99
+
100
+ def resolve_build(root, data):
101
+ allowed = {"mode", "build_dir", "domain", "elf", "runner", "target", "frequency"}
102
+ if not isinstance(data, dict) or set(data) - allowed:
103
+ raise ValueError("Unsupported build configuration fields.")
104
+ mode = data.get("mode")
105
+ if mode not in {"live", "replay"}:
106
+ raise ValueError("Mode must be live or replay.")
107
+ for key in ("domain", "elf", "runner", "target"):
108
+ value = data.get(key)
109
+ if value is not None and (not isinstance(value, str) or not value.strip()):
110
+ raise ValueError(f"{key} must be a non-empty string when provided.")
111
+ frequency = data.get("frequency")
112
+ if frequency is not None and (type(frequency) is not int or frequency <= 0):
113
+ raise ValueError("Probe frequency must be a positive integer in Hz.")
114
+ if data.get("runner") is not None and data["runner"] not in AVAILABLE_RUNNERS:
115
+ raise ValueError(f"Supported runners: {', '.join(AVAILABLE_RUNNERS)}.")
116
+ if mode == "replay" and any(data.get(k) is not None for k in ("runner", "target", "frequency")):
117
+ raise ValueError("Replay does not use live connection overrides.")
118
+ build = local_path(root, data.get("build_dir"))
119
+ if not build.is_dir():
120
+ raise ValueError("Build directory must be a directory.")
121
+
122
+ domains_file = artifact(root, build / "domains.yaml")
123
+ domains = []
124
+ selected = data.get("domain")
125
+ if domains_file:
126
+ config = yaml.safe_load(domains_file.read_text())
127
+ if not isinstance(config, dict) or not isinstance(config.get("domains"), list):
128
+ raise ValueError("Malformed domains.yaml.")
129
+ domains = [d["name"] for d in config["domains"]]
130
+ if not all(isinstance(d, str) for d in domains):
131
+ raise ValueError("Firmware image names must be strings.")
132
+ selected = selected or config.get("default")
133
+ else:
134
+ domains = ["app"]
135
+ selected = selected or "app"
136
+
137
+ # The package remains authoritative for sysbuild path/default resolution.
138
+ image = local_path(root, str(image_dir(build, selected)))
139
+ if not image.is_dir():
140
+ raise ValueError("Firmware image build directory must be a directory.")
141
+ runners = artifact(root, image / "zephyr" / "runners.yaml")
142
+ elf_override = data.get("elf")
143
+ elf_override = input_path(root, elf_override)[0] if elf_override else None
144
+ warnings = []
145
+ if mode == "live":
146
+ runner = data.get("runner") or live_runner(runners, warnings)
147
+ target = Target.from_build_dir(
148
+ build, selected, elf=str(elf_override) if elf_override else None,
149
+ runner=runner, target=data.get("target"),
150
+ frequency=frequency, warn=warnings.append,
151
+ )
152
+ elf = input_path(root, str(target.elf))[0]
153
+ runner, mcu, clock = target.runner, target.target, target.frequency
154
+ else:
155
+ elf = input_path(root, str(elf_override or find_elf(image)))[0]
156
+ runner, mcu, clock = None, None, None
157
+
158
+ cache = cache_values(artifact(root, image / "CMakeCache.txt"))
159
+ board = board_name(artifact(root, image / "zephyr" / ".config"), cache)
160
+ source = cache.get("APPLICATION_SOURCE_DIR")
161
+ source_dir, git = checkout_context(root, source)
162
+ if elf_override:
163
+ warnings.append("ELF override selected. Ensure it matches this build and recording.")
164
+ if not board:
165
+ warnings.append("Board is unknown: no board identity was found in the build.")
166
+ return {
167
+ "build_dir": build.relative_to(root).as_posix(),
168
+ "image_dir": image.relative_to(root).as_posix(),
169
+ "domain": selected, "domains": domains,
170
+ "elf": elf.relative_to(root).as_posix(),
171
+ "elf_override": elf_override.relative_to(root).as_posix() if elf_override else None,
172
+ "board": board,
173
+ "project": Path(source).name if source else build.name,
174
+ "source_dir": source_dir, "git": git,
175
+ "runner": runner, "target": mcu, "frequency": clock,
176
+ "warnings": warnings,
177
+ }
zview_gui/cli.py ADDED
@@ -0,0 +1,133 @@
1
+ """``zview-gui``: serve the browser UI, optionally connected Live to a Zephyr build.
2
+
3
+ ``west zview-gui`` finds the build directory and calls :func:`run` with the same
4
+ options; this command takes the build directory explicitly.
5
+ """
6
+
7
+ import argparse
8
+ import asyncio
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ from . import __version__
13
+ from .console import Console, wants_color
14
+ from .launch import LIVE_OVERRIDES, data_root_for, heap_period, live_request
15
+
16
+ EPILOG = """\
17
+ Without -d, it serves Replay only, reading files under --data-root (default:
18
+ the current directory). With -d, it connects Live to that build; the ELF,
19
+ runner, target and probe clock come from its runners.yaml unless overridden,
20
+ and the data root defaults to the build and its application sources.
21
+ """
22
+
23
+
24
+ class LaunchError(Exception):
25
+ """A setup problem to report as a one-line error, without a traceback."""
26
+
27
+
28
+ def add_serve_options(parser):
29
+ """The options ``zview-gui`` and ``west zview-gui`` share (same dests)."""
30
+ parser.add_argument("-d", "--build-dir", help="Zephyr build directory to connect Live to.")
31
+ parser.add_argument("--domain", help="Firmware image of a sysbuild build.")
32
+ parser.add_argument("-e", "--elf-file", help="ELF override.")
33
+ parser.add_argument("-r", "--runner", help="Probe runner override (gdb, jlink, nrfutil, pyocd).")
34
+ parser.add_argument("-t", "--runner-target", help="MCU/target override.")
35
+ parser.add_argument("--frequency", type=int, help="Probe clock override, in Hz.")
36
+ parser.add_argument("--period", type=float, default=0.1,
37
+ help="Live polling period in seconds; 0 polls back-to-back (default: 0.1).")
38
+ parser.add_argument("--heap-period", type=float,
39
+ help="Minimum period between heap map captures, in seconds "
40
+ "(default: --period, so fragmentation follows heap polling).")
41
+ parser.add_argument("--heap-cooldown", type=float, default=0.0,
42
+ help="Minimum delay after a completed heap map, in seconds (default: 0).")
43
+ parser.add_argument("--port", type=int,
44
+ help="Local port; 0 picks a free one (default: 8765, "
45
+ "or a free port when 8765 is taken).")
46
+ parser.add_argument("--data-root", help="Trusted directory the UI may read paths from.")
47
+ parser.add_argument("--no-open", action="store_true", help="Do not open the browser.")
48
+
49
+
50
+ def build_parser():
51
+ parser = argparse.ArgumentParser(
52
+ prog="zview-gui", description=__doc__.split("\n\n")[0], epilog=EPILOG,
53
+ formatter_class=argparse.RawDescriptionHelpFormatter,
54
+ )
55
+ add_serve_options(parser)
56
+ parser.add_argument("--site", type=Path,
57
+ help="Serve this browser site instead of the packaged one.")
58
+ parser.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
59
+ return parser
60
+
61
+
62
+ # The option dest that sets each Live override.
63
+ OVERRIDE_DESTS = {"domain": "domain", "elf": "elf_file", "runner": "runner",
64
+ "target": "runner_target", "frequency": "frequency"}
65
+
66
+
67
+ def _overrides(args):
68
+ return {key: getattr(args, OVERRIDE_DESTS[key]) for key in LIVE_OVERRIDES}
69
+
70
+
71
+ def run(args, *, build_dir=None, topdir=None, site=None, color=True):
72
+ """Serve until Ctrl+C. ``build_dir`` (resolved) enables Live; raises LaunchError."""
73
+ from zview.logging_setup import configure as configure_logging
74
+
75
+ from . import server
76
+
77
+ overrides = _overrides(args)
78
+ # Like `west zview`: ZView's warnings (e.g. resynced broken frames) go to
79
+ # its rotating log file instead of flooding the terminal.
80
+ log = configure_logging()
81
+ console = Console(color=color and wants_color(sys.stdout))
82
+ console.field("ZView log", log)
83
+
84
+ live = None
85
+ if build_dir is None:
86
+ if any(value is not None for value in overrides.values()):
87
+ raise LaunchError("-e, -r, -t, --domain and --frequency need a build directory (-d).")
88
+ root = Path(args.data_root or ".").resolve()
89
+ else:
90
+ extra = [args.elf_file] if args.elf_file else []
91
+ try:
92
+ root = (Path(args.data_root).resolve() if args.data_root
93
+ else data_root_for(build_dir, topdir, extra))
94
+ live = live_request(root, build_dir, **overrides)
95
+ except ValueError as error:
96
+ raise LaunchError(f"{error} Pass --data-root containing the build and ELF.") from None
97
+ console.field("Build directory", build_dir)
98
+ console.field("Data root", root)
99
+
100
+ site = Path(site).resolve() if site is not None else server.default_site()
101
+ if not server.site_ready(site):
102
+ raise LaunchError(f"No browser site in {site}. Reinstall zview-gui, or build the "
103
+ "site from a source checkout with `just web-setup && just web-build`.")
104
+ if site != server.PACKAGED_SITE:
105
+ console.field("Browser site", site)
106
+
107
+ try:
108
+ asyncio.run(server.serve(
109
+ root, port=args.port, period=args.period,
110
+ heap_period=heap_period(args.period, args.heap_period),
111
+ heap_cooldown=args.heap_cooldown, live=live, open_browser=not args.no_open,
112
+ console=console, site=site,
113
+ ))
114
+ except KeyboardInterrupt:
115
+ pass
116
+ except (OSError, ValueError) as error:
117
+ raise LaunchError(str(error)) from None
118
+
119
+
120
+ def main(argv=None):
121
+ parser = build_parser()
122
+ args = parser.parse_args(argv)
123
+ build_dir = None
124
+ if args.build_dir is not None:
125
+ build_dir = Path(args.build_dir).resolve()
126
+ if not (build_dir / "CMakeCache.txt").is_file():
127
+ parser.error(f"'{args.build_dir}' is not a build directory (no CMakeCache.txt).")
128
+ try:
129
+ run(args, build_dir=build_dir, site=args.site)
130
+ except LaunchError as error:
131
+ print(f"zview-gui: error: {error}", file=sys.stderr)
132
+ return 1
133
+ return 0
zview_gui/console.py ADDED
@@ -0,0 +1,105 @@
1
+ """Terminal output for the adapter: levels in colour, session events as they happen."""
2
+
3
+ import os
4
+ import sys
5
+ import time
6
+
7
+ RESET = "\033[0m"
8
+ STYLES = {
9
+ "label": "\033[1;35m", # bold magenta "ZView GUI" prefix
10
+ "info": "",
11
+ "success": "\033[32m", # green
12
+ "warning": "\033[33m", # yellow
13
+ "error": "\033[1;31m", # bold red
14
+ "hint": "\033[2m", # dim
15
+ "url": "\033[1;4;36m", # bold underlined cyan
16
+ "value": "\033[1m", # bold
17
+ }
18
+ PREFIX = "ZView GUI"
19
+ # Live statuses worth a line, and their level. "stopping" is followed by "stopped".
20
+ STATUSES = {
21
+ "reading": ("success", "reading frames"),
22
+ "lost": ("error", "connection lost"),
23
+ "failed": ("error", "failed"),
24
+ "stopped": ("info", "stopped"),
25
+ "ended": ("info", "replay ended"),
26
+ }
27
+ NOTICE_REPEAT = 30.0
28
+
29
+
30
+ def wants_color(stream):
31
+ """Colour on a terminal unless NO_COLOR is set; FORCE_COLOR forces it."""
32
+ if os.environ.get("NO_COLOR"):
33
+ return False
34
+ if os.environ.get("FORCE_COLOR"):
35
+ return True
36
+ return hasattr(stream, "isatty") and stream.isatty()
37
+
38
+
39
+ class Console:
40
+ """Prints ``ZView GUI: <message>`` lines, coloured by level when ``color``."""
41
+
42
+ def __init__(self, stream=None, *, color=None, clock=time.monotonic):
43
+ self.stream = stream
44
+ self.color = wants_color(stream or sys.stdout) if color is None else color
45
+ self.clock = clock
46
+ self._status = None
47
+ self._notice = (None, 0.0)
48
+
49
+ def style(self, kind, text):
50
+ code = STYLES[kind] if self.color else ""
51
+ return f"{code}{text}{RESET}" if code else str(text)
52
+
53
+ def say(self, level, message):
54
+ stream = self.stream or (sys.stderr if level in {"warning", "error"} else sys.stdout)
55
+ print(f"{self.style('label', PREFIX + ':')} {self.style(level, message)}",
56
+ file=stream, flush=True)
57
+
58
+ def info(self, message):
59
+ self.say("info", message)
60
+
61
+ def success(self, message):
62
+ self.say("success", message)
63
+
64
+ def warning(self, message):
65
+ self.say("warning", message)
66
+
67
+ def error(self, message):
68
+ self.say("error", message)
69
+
70
+ def hint(self, message):
71
+ self.say("hint", message)
72
+
73
+ def field(self, label, value):
74
+ """``label: value`` with the value emphasised, e.g. paths at startup."""
75
+ self.say("info", f"{label}: {self.style('value', value)}")
76
+
77
+ def connecting(self, context):
78
+ board = context.get("board") or "board unknown"
79
+ target = context.get("target") or "default target"
80
+ self.info(f"connecting to {self.style('value', board)} via "
81
+ f"{self.style('value', context['runner'])} ({target})")
82
+
83
+ def serving(self, url):
84
+ self.info(f"open {self.style('url', url)}")
85
+ self.hint("Ctrl+C disconnects and stops the server.")
86
+
87
+ def session_event(self, kind, data):
88
+ """Report status changes and notices; frames and the rest stay silent."""
89
+ if kind == "status":
90
+ status = data.get("status")
91
+ if status == self._status or status not in STATUSES:
92
+ return
93
+ self._status = status
94
+ level, text = STATUSES[status]
95
+ error = data.get("error")
96
+ self.say(level, f"Live {text}: {error}" if error else f"Live {text}")
97
+ elif kind == "notice":
98
+ # Read faults can repeat every frame: print a repeat at most every 30 s.
99
+ message = data.get("message", "")
100
+ last, at = self._notice
101
+ now = self.clock()
102
+ if message == last and now - at < NOTICE_REPEAT:
103
+ return
104
+ self._notice = (message, now)
105
+ self.warning(message)
@@ -0,0 +1,91 @@
1
+ """One session's optional heap-map request, shared by interested browser clients."""
2
+
3
+ import math
4
+ import threading
5
+ import time
6
+
7
+
8
+ def seconds(value, *, allow_zero=True):
9
+ if (
10
+ type(value) not in (int, float) or not math.isfinite(value)
11
+ or value < 0 or (not allow_zero and value == 0)
12
+ ):
13
+ raise ValueError("Timing values must be finite seconds, "
14
+ + ("zero or greater." if allow_zero else "greater than zero."))
15
+ return float(value)
16
+
17
+
18
+ class HeapCaptureBusy(Exception):
19
+ pass
20
+
21
+
22
+ class HeapCapture:
23
+ """Thread-safe interest and cadence; probe operations stay with the live worker."""
24
+
25
+ def __init__(self, clock=time.monotonic, *, period=1., cooldown=1.):
26
+ self._lock = threading.Lock()
27
+ self._clock = clock
28
+ self.period = seconds(period, allow_zero=False)
29
+ self.cooldown = seconds(cooldown)
30
+ self._heap = None
31
+ self._owners = set()
32
+ self._generation = 0
33
+ self._next = 0.
34
+ self._failed = False
35
+
36
+ def choose(self, owner, heap):
37
+ with self._lock:
38
+ others = self._owners - {owner}
39
+ if heap is not None and others and heap != self._heap:
40
+ # A tab that navigated away no longer owns its previous view,
41
+ # even when its new selection conflicts with another tab.
42
+ self._owners.discard(owner)
43
+ raise HeapCaptureBusy("Another tab is inspecting a different heap. Close that heap detail first.")
44
+ self._owners.discard(owner)
45
+ if heap is not None:
46
+ self._owners.add(owner)
47
+ selected = heap if heap is not None else self._heap if self._owners else None
48
+ if selected != self._heap:
49
+ self._heap = selected
50
+ self._generation += 1
51
+ self._next = 0.
52
+ self._failed = False
53
+ return self._heap
54
+
55
+ def clear(self):
56
+ with self._lock:
57
+ self._owners.clear()
58
+ self._heap = None
59
+ self._generation += 1
60
+
61
+ def due(self):
62
+ with self._lock:
63
+ if self._heap is None or self._failed or self._clock() < self._next:
64
+ return None
65
+ self._next = self._clock() + self.period
66
+ return self._generation, self._heap
67
+
68
+ def accepts(self, request):
69
+ with self._lock:
70
+ return request == (self._generation, self._heap)
71
+
72
+ def completed(self, request):
73
+ with self._lock:
74
+ if request == (self._generation, self._heap):
75
+ # Keep the requested start-to-start period, plus any minimum
76
+ # cooldown after completion. Zero cooldown explicitly opts out
77
+ # of the default protection for slow map reads.
78
+ self._next = max(self._next, self._clock() + self.cooldown)
79
+
80
+ def fail(self, request):
81
+ with self._lock:
82
+ if request == (self._generation, self._heap):
83
+ self._failed = True
84
+
85
+ def identity(self):
86
+ with self._lock:
87
+ return self._heap
88
+
89
+
90
+ def identity(heap):
91
+ return None if heap is None else {"address": heap[0], "name": heap[1]}
zview_gui/launch.py ADDED
@@ -0,0 +1,64 @@
1
+ """Launch helpers shared by ``zview-gui`` and ``west zview-gui``: no aiohttp or ZView."""
2
+
3
+ import os
4
+ from pathlib import Path
5
+
6
+ LIVE_OVERRIDES = ("domain", "elf", "runner", "target", "frequency")
7
+
8
+
9
+ def heap_period(period, requested):
10
+ """Heap maps follow polling unless set; back-to-back polling maps back-to-back too."""
11
+ if requested is not None:
12
+ return requested
13
+ return period if period > 0 else 0.001
14
+
15
+
16
+ def application_source(build_dir):
17
+ """The application source directory recorded in ``CMakeCache.txt``, if any."""
18
+ cache = Path(build_dir) / "CMakeCache.txt"
19
+ if not cache.is_file():
20
+ return None
21
+ for line in cache.read_text(errors="replace").splitlines():
22
+ if line.startswith("APPLICATION_SOURCE_DIR:"):
23
+ path = Path(line.split("=", 1)[1].strip())
24
+ return path.resolve() if path.is_dir() else None
25
+ return None
26
+
27
+
28
+ def data_root_for(build_dir, topdir=None, extra=()):
29
+ """
30
+ The narrowest trusted root holding the build, its sources and ``extra`` paths.
31
+ The west workspace is preferred when it holds them all. When their only common
32
+ ancestor is the filesystem root, or they are on different Windows drives, only the
33
+ build directory (and ``extra``) is used.
34
+ """
35
+ build = Path(build_dir).resolve()
36
+ required = [build, *(Path(p).resolve() for p in extra)]
37
+ source = application_source(build)
38
+ wanted = [*required, *([source] if source else [])]
39
+ if topdir is not None:
40
+ top = Path(topdir).resolve()
41
+ if all(p.is_relative_to(top) for p in wanted):
42
+ return top
43
+ for paths in (wanted, required):
44
+ try:
45
+ common = Path(os.path.commonpath([str(p) for p in paths]))
46
+ except ValueError: # on different Windows drives: try the required inputs alone
47
+ continue
48
+ if common != Path(common.anchor):
49
+ return common if common.is_dir() else common.parent
50
+ raise ValueError("The build and its inputs share no directory but the filesystem root.")
51
+
52
+
53
+ def live_request(root, build_dir, **overrides):
54
+ """The adapter's Live configuration: root-relative paths, only the overrides set."""
55
+ root = Path(root).resolve()
56
+ request = {"build_dir": Path(build_dir).resolve().relative_to(root).as_posix()}
57
+ for key in LIVE_OVERRIDES:
58
+ value = overrides.get(key)
59
+ if value is None:
60
+ continue
61
+ if key == "elf":
62
+ value = Path(value).resolve().relative_to(root).as_posix()
63
+ request[key] = value
64
+ return request