[llvm-branch-commits] [llvm] [MC] Rewrite stdin.s to use python (PR #157232)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Sep 8 10:17:20 PDT 2025


================
@@ -0,0 +1,17 @@
+# RUN: echo "// comment" > %t.input
+# RUN: which llvm-mc | %python %s %t
+
+import subprocess
+import sys
+
+llvm_mc_binary = sys.stdin.readlines()[0].strip()
+temp_file = sys.argv[1]
----------------
boomanaiden154 wrote:

Python doesn't include the interpreter in `sys.argv`:
```
aidengrossman-mac2:build aidengrossman$ python3 /tmp/test.py hello
['/tmp/test.py', 'hello']
aidengrossman-mac2:build aidengrossman$ cat /tmp/test.py
import sys

print(sys.argv)
aidengrossman-mac2:build aidengrossman$
```

Point taken about `argparse` though. I'll wire that up.

https://github.com/llvm/llvm-project/pull/157232


More information about the llvm-branch-commits mailing list