upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tools/mc_command.py
diff options
context:
space:
mode:
authorRayhan Robin <rarobin2912@gmail.com>2026-11-21 22:52:38 -0600
committerItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com>2026-11-22 00:33:49 -0500
commitd3cd5fbd8f9808891c41ad34aa3398fc4bea3446 (patch)
treeea0f9ec4c2d9fab31684f770b7b2eb6881688b34 /tools/mc_command.py
parentc291af6cdebd56e4d4aefda54565b52915ae36ff (diff)
BUILD: report a malformed LLVM_MC without an import-time traceback
(cherry picked from commit 6caeded81788e10c1f0bda7714d954e0ddff5335)
Diffstat (limited to 'tools/mc_command.py')
-rw-r--r--tools/mc_command.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/mc_command.py b/tools/mc_command.py
index 317c0215e..77f19b4c0 100644
--- a/tools/mc_command.py
+++ b/tools/mc_command.py
@@ -18,9 +18,15 @@ def split_command(raw: str) -> list:
18 return [] 18 return []
19 if os.path.isfile(raw): 19 if os.path.isfile(raw):
20 return [raw] # a plain path, spaces and all 20 return [raw] # a plain path, spaces and all
21 if os.name != "nt": 21 try:
22 return shlex.split(raw) 22 if os.name != "nt":
23 parts = shlex.split(raw, posix=False) 23 parts = shlex.split(raw)
24 else:
25 parts = shlex.split(raw, posix=False)
26 except ValueError as e:
27 # shader_disasm.py calls mc_command() at import time: a bad LLVM_MC must give one clear line,
28 # not a ValueError traceback before any tool's own argument parsing runs.
29 raise SystemExit(f"LLVM_MC: invalid command line {raw!r}: {e}") from None
24 return [p[1:-1] if len(p) > 1 and p[0] == p[-1] == '"' else p for p in parts] 30 return [p[1:-1] if len(p) > 1 and p[0] == p[-1] == '"' else p for p in parts]
25 31
26 32