Skip to contentSkip to conversation

scripts: dump stdin on meson-buildoptions error

PATCH In review Patrick Venture 2 participants 3 messages Feb 27, 2025 – Feb 28, 2025 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: dump stdin on meson-buildoptions error

From: Nabih Estefan <[email protected]>

Dump sys.stdin when it errors on meson-buildoptions.py, letting us debug the build errors instead of just saying "Couldn't parse"

---
 scripts/meson-buildoptions.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
scripts/meson-buildoptions.py +8 -2
index 4814a8ff61..a3e22471b2 100644
@@ -241,8 +241,14 @@ def print_parse(options):
     print("  esac")
     print("}")
 
-
-options = load_options(json.load(sys.stdin))
+json_data = sys.stdin.read()
+try:
+    options = load_options(json.loads(json_data))
+except:
+    print("Failure in scripts/meson-buildoptions.py parsing stdin as json",
+          file=sys.stderr)
+    print(json_data, file=sys.stderr)
+    sys.exit(1)
 print("# This file is generated by meson-buildoptions.py, do not edit!")
 print_help(options)
 print_parse(options)
Signature · 1 line
2.48.1.658.g4767266eb4-goog
#1 lore raw
Quoted 2 lines

Dump sys.stdin when it errors on meson-buildoptions.py, letting us debug the build errors instead of just saying "Couldn't parse"

Sure, why not. :) Queued the patch, it should go into 10.0.

Paolo

#2 lore raw
Quoted 5 lines · Paolo Bonzini
Quoted 2 lines

Dump sys.stdin when it errors on meson-buildoptions.py, letting us debug the build errors instead of just saying "Couldn't parse"

Sure, why not. :) Queued the patch, it should go into 10.0.

Thanks! we kept seeing this because we didn't have rustc installed and it would just fail to parse the json. :)

Quoted 4 lines

Paolo