pyvisionect 0.1.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.
Files changed (58) hide show
  1. pyvisionect/__init__.py +120 -0
  2. pyvisionect/devices/__init__.py +92 -0
  3. pyvisionect/devices/enums.py +403 -0
  4. pyvisionect/devices/panels.py +242 -0
  5. pyvisionect/devices/tclv.py +460 -0
  6. pyvisionect/imaging/README.md +175 -0
  7. pyvisionect/imaging/__init__.py +181 -0
  8. pyvisionect/imaging/checksum.py +114 -0
  9. pyvisionect/imaging/constants.py +131 -0
  10. pyvisionect/imaging/data/blue_noise_64.npy +0 -0
  11. pyvisionect/imaging/decode.py +172 -0
  12. pyvisionect/imaging/dither.py +357 -0
  13. pyvisionect/imaging/encoder.py +594 -0
  14. pyvisionect/imaging/geometry.py +129 -0
  15. pyvisionect/imaging/grey.py +104 -0
  16. pyvisionect/imaging/interlace.py +244 -0
  17. pyvisionect/imaging/pack.py +142 -0
  18. pyvisionect/imaging/panel.py +339 -0
  19. pyvisionect/imaging/partial.py +931 -0
  20. pyvisionect/imaging/rects.py +466 -0
  21. pyvisionect/io/__init__.py +33 -0
  22. pyvisionect/io/tcp.py +795 -0
  23. pyvisionect/io/usb/__init__.py +237 -0
  24. pyvisionect/io/usb/cli.py +278 -0
  25. pyvisionect/io/usb/commands.py +781 -0
  26. pyvisionect/io/usb/console.py +730 -0
  27. pyvisionect/io/usb/device.py +914 -0
  28. pyvisionect/io/usb/discovery.py +260 -0
  29. pyvisionect/io/usb/encryption.py +262 -0
  30. pyvisionect/io/usb/errors.py +175 -0
  31. pyvisionect/io/usb/fake.py +292 -0
  32. pyvisionect/io/usb/parsers.py +1464 -0
  33. pyvisionect/io/usb/provisioning.py +502 -0
  34. pyvisionect/packets/__init__.py +135 -0
  35. pyvisionect/packets/control.py +95 -0
  36. pyvisionect/packets/file.py +325 -0
  37. pyvisionect/packets/image.py +234 -0
  38. pyvisionect/packets/misc.py +202 -0
  39. pyvisionect/packets/param.py +284 -0
  40. pyvisionect/packets/status.py +518 -0
  41. pyvisionect/packets/stored.py +217 -0
  42. pyvisionect/py.typed +0 -0
  43. pyvisionect/session/__init__.py +100 -0
  44. pyvisionect/session/connection.py +1043 -0
  45. pyvisionect/session/device.py +587 -0
  46. pyvisionect/session/events.py +196 -0
  47. pyvisionect/session/filetransfer.py +251 -0
  48. pyvisionect/session/pending.py +425 -0
  49. pyvisionect/wire/__init__.py +91 -0
  50. pyvisionect/wire/blocks.py +350 -0
  51. pyvisionect/wire/checksum.py +115 -0
  52. pyvisionect/wire/errors.py +176 -0
  53. pyvisionect/wire/framing.py +334 -0
  54. pyvisionect-0.1.0.dist-info/METADATA +1030 -0
  55. pyvisionect-0.1.0.dist-info/RECORD +58 -0
  56. pyvisionect-0.1.0.dist-info/WHEEL +4 -0
  57. pyvisionect-0.1.0.dist-info/entry_points.txt +3 -0
  58. pyvisionect-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,237 @@
1
+ '''USB serial access to a Visionect sign -- the only way to bootstrap one.
2
+
3
+ Why this package exists
4
+ -----------------------
5
+
6
+ Eight TCLV ids are ``canWrite: false`` in the vendor's own admin-UI descriptor
7
+ table, and they are exactly the ones a first-time setup needs: ``CONN_TYPE`` (2),
8
+ ``IPV4_SERVER_IP`` (18), ``IPV4_SERVER_PORT`` (19), ``WIFI_SSID`` (65),
9
+ ``WIFI_SECURITY`` (66), ``WIFI_PSK`` (67), ``WIFI_BAND`` (68),
10
+ ``MOB_SECURITY`` (70). The network protocol reads them and never writes them, so
11
+ there is no over-the-air escape -- you cannot tell a sign about a new WiFi
12
+ network over the network it does not have. USB, or nothing.
13
+
14
+ (Or DNS: if the sign already holds a *hostname* in TCLV 18, re-point that name
15
+ and touch nothing. :func:`~pyvisionect.io.usb.provisioning.describe_alternatives`
16
+ puts this in the output of every dry run, because it is the cheapest answer and
17
+ the one nobody thinks of.)
18
+
19
+ The transport is a USB-to-UART bridge -- **FTDI FT232, ``0403:6001``, confirmed
20
+ on hardware** -- carrying a line-oriented ASCII shell at **115200 8N1**. Submit
21
+ with ``\\r``; the prompt is ``"> "``; the device echoes. The firmware also logs
22
+ to the same UART unprompted, which is the one genuinely hard problem here and the
23
+ subject of :mod:`~pyvisionect.io.usb.console`.
24
+
25
+ Layout
26
+ ------
27
+
28
+ ================================================ =============================
29
+ :mod:`~pyvisionect.io.usb.console` the transport: frames, prompt
30
+ sync, async-log separation
31
+ :mod:`~pyvisionect.io.usb.commands` the 112 commands this firmware
32
+ has, the 111 ``help`` admits
33
+ to, and the 95 unlisted ones
34
+ :mod:`~pyvisionect.io.usb.parsers` one dataclass per getter
35
+ :mod:`~pyvisionect.io.usb.device` :class:`Sign` -- the typed
36
+ surface, with write gating
37
+ :mod:`~pyvisionect.io.usb.provisioning` dry-runnable bootstrap flows
38
+ :mod:`~pyvisionect.io.usb.discovery` find the port, confirm the sign
39
+ :mod:`~pyvisionect.io.usb.encryption` what is known about the
40
+ encryption setters, and how
41
+ :mod:`~pyvisionect.io.usb.fake` the real sign's real replies,
42
+ for tests
43
+ ================================================ =============================
44
+
45
+ Quick start
46
+ -----------
47
+
48
+ Read-only, which is the default and cannot change anything::
49
+
50
+ from pyvisionect.io.usb import SerialConsole, Sign
51
+
52
+ with SerialConsole("/dev/ttyUSB0") as console:
53
+ console.sync()
54
+ sign = Sign(console)
55
+ print(sign.dump().describe())
56
+
57
+ Repointing a sign at your own server, reviewed before it happens::
58
+
59
+ from pyvisionect.io.usb import Sign, SerialConsole, plan_repoint
60
+
61
+ plan = plan_repoint("my-listener.example.com")
62
+ print(plan.describe()) # read this. it is the point.
63
+
64
+ with SerialConsole("/dev/ttyUSB0") as console:
65
+ console.sync()
66
+ sign = Sign(console, allow_destructive=True)
67
+ plan.execute(sign)
68
+
69
+ Two things that will bite you
70
+ -----------------------------
71
+
72
+ * **Nothing persists until ``flash_save``.** Verbatim from the vendor: *"All
73
+ changes to device configuration are by default retained only in the working
74
+ RAM."* That is a safety net right up until you use it.
75
+ * **``sf_rdid`` and ``sf_rdst`` kill the console.** They assert in the firmware
76
+ and take ``usb_cli_task`` with them; the sign keeps running but the prompt is
77
+ gone until it reboots, which it does on its own about 25 minutes later when the
78
+ software watchdog gives up. Both are gated behind ``i_really_mean_it`` for
79
+ that reason alone -- they read nothing and write nothing. Measured, not
80
+ theorised.
81
+
82
+ Soft sleep
83
+ ----------
84
+
85
+ The vendor documents a "soft sleep" that cuts the console after 15 seconds of
86
+ accelerometer inactivity, and recommends setting ``SLEEP_MODE`` (52) to 1 for a
87
+ working session. **It did not happen on firmware 7.4.4407.** A console session
88
+ held a prompt across an undisturbed 70-second idle window and answered
89
+ immediately afterwards, on a sign whose uptime was 25 days -- so the CLI had been
90
+ reachable that whole time without anyone touching it. This package therefore
91
+ does **not** send a keepalive and does **not** touch TCLV 52, both of which would
92
+ be writes on a read-only session. If you meet a build where it does bite,
93
+ ``SLEEP_MODE`` is the documented lever.
94
+ '''
95
+
96
+ from __future__ import annotations
97
+
98
+ from .commands import (
99
+ ABSENT_FROM_7_4_4407,
100
+ HIDDEN_IN_7_4_4407,
101
+ LISTED_BY_HELP,
102
+ ASSERTS_AND_KILLS_CLI,
103
+ COMMANDS,
104
+ DESTRUCTIVE_COMMANDS,
105
+ DOCUMENTED_COUNT,
106
+ HARD_COMMANDS,
107
+ PROBED_ABSENT_7_4_4407,
108
+ READ_COMMANDS,
109
+ TCLV_FOR,
110
+ UNDOCUMENTED_IN_7_4_4407,
111
+ VLOG_DESTINATIONS,
112
+ VLOG_LEVELS,
113
+ VLOG_QUIET,
114
+ VLOG_VERBOSE,
115
+ Command,
116
+ Kind,
117
+ )
118
+ from .console import (
119
+ BAUD_RATE,
120
+ LOG_PATTERNS,
121
+ PROMPT,
122
+ TERMINATOR,
123
+ CommandResult,
124
+ LogLine,
125
+ SerialConsole,
126
+ SerialTransport,
127
+ classify,
128
+ )
129
+ from .device import Sign, SignInfo
130
+ from .discovery import (
131
+ FTDI_PIDS,
132
+ FTDI_VID,
133
+ KNOWN_BRIDGES,
134
+ Candidate,
135
+ Identity,
136
+ find_ports,
137
+ identify,
138
+ )
139
+ from .errors import (
140
+ CommandNotInFirmware,
141
+ ConsoleAssertionFailed,
142
+ ConsoleError,
143
+ ConsoleNotOpen,
144
+ ConsoleTimeout,
145
+ DangerousCommandRefused,
146
+ IncorrectParameters,
147
+ PromptNotFound,
148
+ UnknownCommand,
149
+ WriteNotAllowed,
150
+ )
151
+ from .provisioning import (
152
+ DEFAULT_SERVER_PORT,
153
+ Plan,
154
+ Step,
155
+ WifiSecurity,
156
+ describe_alternatives,
157
+ plan_bootstrap,
158
+ plan_repoint,
159
+ plan_wifi,
160
+ )
161
+
162
+ __all__ = [
163
+ "ABSENT_FROM_7_4_4407",
164
+ "HIDDEN_IN_7_4_4407",
165
+ "LISTED_BY_HELP",
166
+ "ASSERTS_AND_KILLS_CLI",
167
+ "BAUD_RATE",
168
+ "COMMANDS",
169
+ "DEFAULT_SERVER_PORT",
170
+ "DESTRUCTIVE_COMMANDS",
171
+ "DOCUMENTED_COUNT",
172
+ "FTDI_PIDS",
173
+ "FTDI_VID",
174
+ "HARD_COMMANDS",
175
+ "KNOWN_BRIDGES",
176
+ "LOG_PATTERNS",
177
+ "PROMPT",
178
+ "READ_COMMANDS",
179
+ "TCLV_FOR",
180
+ "TERMINATOR",
181
+ "UNDOCUMENTED_IN_7_4_4407",
182
+ "PROBED_ABSENT_7_4_4407",
183
+ "VLOG_DESTINATIONS",
184
+ "VLOG_LEVELS",
185
+ "VLOG_QUIET",
186
+ "VLOG_VERBOSE",
187
+ "Candidate",
188
+ "Command",
189
+ "CommandNotInFirmware",
190
+ "CommandResult",
191
+ "ConsoleAssertionFailed",
192
+ "ConsoleError",
193
+ "ConsoleNotOpen",
194
+ "ConsoleTimeout",
195
+ "DangerousCommandRefused",
196
+ "Identity",
197
+ "IncorrectParameters",
198
+ "Kind",
199
+ "LogLine",
200
+ "Plan",
201
+ "PromptNotFound",
202
+ "SerialConsole",
203
+ "SerialTransport",
204
+ "Sign",
205
+ "SignInfo",
206
+ "Step",
207
+ "UnknownCommand",
208
+ "WifiSecurity",
209
+ "WriteNotAllowed",
210
+ "classify",
211
+ "describe_alternatives",
212
+ "find_ports",
213
+ "identify",
214
+ "main",
215
+ "parsers",
216
+ "plan_bootstrap",
217
+ "plan_repoint",
218
+ "plan_wifi",
219
+ ]
220
+
221
+
222
+ def __getattr__(name: str) -> object:
223
+ """Lazy re-exports.
224
+
225
+ ``main`` pulls in :mod:`argparse` and ``parsers`` is only needed by name when
226
+ someone wants the dataclasses without the typed surface; neither belongs in
227
+ the import cost of ``from pyvisionect.io.usb import Sign``.
228
+ """
229
+ if name == "main":
230
+ from .cli import main
231
+
232
+ return main
233
+ if name == "parsers":
234
+ from . import parsers
235
+
236
+ return parsers
237
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -0,0 +1,278 @@
1
+ '''``pyvisionect-usb`` -- the command line over the serial console.
2
+
3
+ Read-only by default, and the destructive subcommands dry-run by default too:
4
+ ``provision`` prints the plan and exits unless you pass ``--execute``. Reading
5
+ the plan is the only chance you get to notice that it is about to point a sign at
6
+ the wrong host, so it is the default rather than a flag.
7
+ '''
8
+
9
+ from __future__ import annotations
10
+
11
+ import argparse
12
+ import dataclasses
13
+ import json
14
+ import logging
15
+ import sys
16
+ from collections.abc import Sequence
17
+
18
+ from .commands import (
19
+ ABSENT_FROM_7_4_4407,
20
+ HIDDEN_IN_7_4_4407,
21
+ LISTED_BY_HELP,
22
+ COMMANDS,
23
+ DOCUMENTED_COUNT,
24
+ PROBED_ABSENT_7_4_4407,
25
+ UNDOCUMENTED_IN_7_4_4407,
26
+ )
27
+ from .console import SerialConsole
28
+ from .device import Sign
29
+ from .discovery import find_ports, identify
30
+ from .provisioning import DEFAULT_SERVER_PORT, WifiSecurity, plan_bootstrap, plan_repoint
31
+
32
+ __all__ = ["main"]
33
+
34
+
35
+ def _as_json(obj: object) -> object:
36
+ """Make a dataclass tree JSON-serialisable, including UUIDs and tuples."""
37
+ import uuid as _uuid
38
+
39
+ if dataclasses.is_dataclass(obj) and not isinstance(obj, type):
40
+ return {
41
+ f.name: _as_json(getattr(obj, f.name)) for f in dataclasses.fields(obj)
42
+ }
43
+ if isinstance(obj, _uuid.UUID):
44
+ return str(obj)
45
+ if isinstance(obj, (list, tuple)):
46
+ return [_as_json(v) for v in obj]
47
+ if isinstance(obj, dict):
48
+ return {str(k): _as_json(v) for k, v in obj.items()}
49
+ return obj
50
+
51
+
52
+ def main(argv: Sequence[str] | None = None) -> int:
53
+ """Entry point for ``pyvisionect-usb``."""
54
+ parser = argparse.ArgumentParser(
55
+ prog="pyvisionect-usb",
56
+ description=(
57
+ "Talk to a Visionect sign over its USB serial console. Read-only "
58
+ "unless you say otherwise; the server address and WiFi credentials "
59
+ "are read-only over the network, so this is the only way to set them."
60
+ ),
61
+ )
62
+ parser.add_argument("-v", "--verbose", action="store_true")
63
+ sub = parser.add_subparsers(dest="cmd", required=True)
64
+
65
+ p = sub.add_parser("ports", help="list candidate serial ports")
66
+ p.add_argument("--all", action="store_true", help="include unrecognised bridges")
67
+
68
+ p = sub.add_parser("identify", help="confirm a port is a sign (2 read-only commands)")
69
+ p.add_argument("port")
70
+
71
+ p = sub.add_parser("dump", help="read every readable setting")
72
+ p.add_argument("port")
73
+ p.add_argument("--json", action="store_true")
74
+
75
+ p = sub.add_parser("run", help="send one command and print the parsed reply")
76
+ p.add_argument("port")
77
+ p.add_argument("command", nargs="+")
78
+ p.add_argument(
79
+ "--allow-writes",
80
+ action="store_true",
81
+ help="permit a setter (still refuses the destructive and hard tiers)",
82
+ )
83
+
84
+ p = sub.add_parser(
85
+ "commands", help="the firmware's command set, and the documented delta"
86
+ )
87
+ p.add_argument("--port", help="read `help` from a device instead of the built-in table")
88
+
89
+ p = sub.add_parser(
90
+ "provision", help="repoint a sign at your server (prints the plan; add --execute)"
91
+ )
92
+ p.add_argument("port")
93
+ p.add_argument("--server", required=True, help="IP or DNS name (TCLV 18)")
94
+ p.add_argument("--server-port", type=int, default=DEFAULT_SERVER_PORT)
95
+ p.add_argument("--ssid", help="WiFi SSID (TCLV 65); omit to leave WiFi alone")
96
+ p.add_argument("--psk", help="WiFi passphrase (TCLV 67)")
97
+ p.add_argument("--security", default=WifiSecurity.WPA2, choices=WifiSecurity.ALL)
98
+ p.add_argument("--band", type=int, default=0, help="0 dual, 1 2.4GHz, 2 5GHz")
99
+ p.add_argument("--conn-type", type=int, help="TCLV 2; run `commands` first")
100
+ p.add_argument("--no-reboot", action="store_true")
101
+ p.add_argument(
102
+ "--execute",
103
+ action="store_true",
104
+ help="actually send it. Without this, the plan is printed and nothing happens.",
105
+ )
106
+
107
+ p = sub.add_parser("encryption", help="what is known about the encryption setters")
108
+
109
+ args = parser.parse_args(argv)
110
+ logging.basicConfig(
111
+ level=logging.DEBUG if args.verbose else logging.WARNING, format="%(message)s"
112
+ )
113
+
114
+ if args.cmd == "ports":
115
+ candidates = find_ports(all_ports=args.all)
116
+ if not candidates:
117
+ print("no candidate ports. Try --all, and check you can read the node:")
118
+ print(" ls -l /dev/ttyUSB* # root:dialout 660 on Linux")
119
+ return 1
120
+ for candidate in candidates:
121
+ mark = "*" if candidate.likely else " "
122
+ print(
123
+ f"{mark} {candidate.device} {candidate.usb_id or '-'} "
124
+ f"{candidate.bridge or candidate.description or ''}"
125
+ )
126
+ print()
127
+ print(
128
+ "A '*' only means the USB id is a known bridge -- 0403:6001 is the "
129
+ "stock FTDI id and is in thousands of unrelated products. Run "
130
+ "`identify` to be sure."
131
+ )
132
+ return 0
133
+
134
+ if args.cmd == "encryption":
135
+ from . import encryption as E
136
+
137
+ print(E.VERDICT)
138
+ print()
139
+ print(f"encryption_mode_set values (TCLV {E.TCLV_ENCRYPTION_MODE}):")
140
+ for value, name in sorted(E.MODES.items()):
141
+ print(f" {value} = {name}")
142
+ print()
143
+ print(f"encryption_key_set (TCLV {E.TCLV_ENCRYPTION_KEY}) -- key format, untested:")
144
+ for candidate in E.KEY_FORMAT_CANDIDATES:
145
+ print(f" {candidate.name} ({candidate.length} chars), e.g. {candidate.example}")
146
+ print()
147
+ print(E.TLS_ALTERNATIVE)
148
+ return 0
149
+
150
+ if args.cmd == "commands" and not args.port:
151
+ print(
152
+ f"{len(COMMANDS)} commands known to exist in firmware 7.4.4407, of "
153
+ f"which {len(LISTED_BY_HELP)} are listed by help; "
154
+ f"{DOCUMENTED_COUNT} documented by the vendor."
155
+ )
156
+ print(
157
+ f" {len(HIDDEN_IN_7_4_4407)} present but hidden from help "
158
+ f"({', '.join(sorted(HIDDEN_IN_7_4_4407))})"
159
+ )
160
+ print(
161
+ f" {len(ABSENT_FROM_7_4_4407)} documented but not listed here "
162
+ f"({len(PROBED_ABSENT_7_4_4407)} probed bare and genuinely absent; "
163
+ f"the other {len(ABSENT_FROM_7_4_4407) - len(PROBED_ABSENT_7_4_4407)} "
164
+ f"are unprobed -- help is not a complete index, so some may be hidden too)"
165
+ )
166
+ print(f" {len(UNDOCUMENTED_IN_7_4_4407)} present but undocumented")
167
+ print()
168
+ for name, entry in sorted(COMMANDS.items()):
169
+ flags = [entry.kind.value]
170
+ if not entry.documented:
171
+ flags.append("UNDOCUMENTED")
172
+ if name in HIDDEN_IN_7_4_4407:
173
+ flags.append("HIDDEN")
174
+ if entry.asserts:
175
+ flags.append(f"ASSERTS@{entry.asserts}")
176
+ print(f"{entry.syntax:<58} [{','.join(flags)}]")
177
+ return 0
178
+
179
+ if args.cmd == "identify":
180
+ result = identify(args.port)
181
+ print(result.describe())
182
+ return 0 if result.is_sign else 1
183
+
184
+ if args.cmd == "provision":
185
+ if args.ssid and not args.psk:
186
+ parser.error("--psk is required with --ssid")
187
+ try:
188
+ plan = (
189
+ plan_bootstrap(
190
+ args.ssid,
191
+ args.psk,
192
+ args.server,
193
+ args.server_port,
194
+ security=args.security,
195
+ band=args.band,
196
+ conn_type=args.conn_type,
197
+ reboot=not args.no_reboot,
198
+ )
199
+ if args.ssid
200
+ else plan_repoint(
201
+ args.server, args.server_port, reboot=not args.no_reboot
202
+ )
203
+ )
204
+ except ValueError as exc:
205
+ # A plan this firmware cannot express -- a passphrase with a space
206
+ # being the one that actually happens; a spaced SSID is fine and
207
+ # expands to the three-setter route. A traceback here would bury
208
+ # the explanation, which is the useful part.
209
+ print(f"cannot build that plan: {exc}", file=sys.stderr)
210
+ return 2
211
+ print(plan.describe())
212
+ if plan.unavailable:
213
+ print()
214
+ print(
215
+ f"REFUSING: firmware 7.4.4407 does not have {list(plan.unavailable)}."
216
+ )
217
+ return 2
218
+ if not args.execute:
219
+ print()
220
+ print("Dry run. Nothing was sent. Add --execute to do it for real.")
221
+ return 0
222
+ with SerialConsole(args.port) as console:
223
+ console.sync()
224
+ sign = Sign(console, allow_destructive=True)
225
+ sign.refresh_commands()
226
+ for step, result in zip(plan.steps, plan.execute(sign)):
227
+ print(f"$ {step.command}\n{result.text}")
228
+ return 0
229
+
230
+ # the remaining subcommands all need an open console
231
+ with SerialConsole(args.port) as console:
232
+ console.sync()
233
+ if args.cmd == "commands":
234
+ sign = Sign(console)
235
+ names = sign.refresh_commands()
236
+ print(f"{len(names)} commands on this device")
237
+ for name in sorted(names):
238
+ known = COMMANDS.get(name)
239
+ note = "" if known else " [not in this library's table]"
240
+ print(f" {name}{note}")
241
+ return 0
242
+
243
+ if args.cmd == "dump":
244
+ sign = Sign(console)
245
+ info = sign.dump()
246
+ if args.json:
247
+ print(json.dumps(_as_json(info), indent=2, sort_keys=True))
248
+ else:
249
+ print(info.describe())
250
+ print()
251
+ for f in dataclasses.fields(info):
252
+ if f.name == "errors":
253
+ continue
254
+ value = getattr(info, f.name)
255
+ if value not in (None, (), {}):
256
+ print(f"{f.name}: {value}")
257
+ if info.errors:
258
+ print()
259
+ print("could not read:")
260
+ for name, why in sorted(info.errors.items()):
261
+ print(f" {name}: {why}")
262
+ return 0
263
+
264
+ if args.cmd == "run":
265
+ sign = Sign(console, allow_writes=args.allow_writes)
266
+ result = sign._run(" ".join(args.command))
267
+ print(result.text)
268
+ if result.rv is not None:
269
+ print(f"(rv {result.rv})")
270
+ for entry in result.logs:
271
+ print(f"[async] {entry.text}", file=sys.stderr)
272
+ return 0 if result.ok else 1
273
+
274
+ return 0 # pragma: no cover
275
+
276
+
277
+ if __name__ == "__main__": # pragma: no cover
278
+ sys.exit(main())