|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Shelley Vohr < [email protected]> |
| 3 | +Date: Tue, 10 Feb 2026 16:48:47 +0100 |
| 4 | +Subject: fix: generate_config_gypi needs to generate valid JSON |
| 5 | + |
| 6 | +Node.js added new process.config.variables entries, which the GN generator |
| 7 | +emitted with Python repr (single quotes). This made the JSON parse blow |
| 8 | +up. Fix this by switching to json.dumps. |
| 9 | + |
| 10 | +This should be upstreamed. |
| 11 | + |
| 12 | +diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py |
| 13 | +index abd11e1dbda8d400cb900343c6e8d2d6e84fe944..436767e633e1f492fa858645e25ce9b904a5fccb 100755 |
| 14 | +--- a/tools/generate_config_gypi.py |
| 15 | ++++ b/tools/generate_config_gypi.py |
| 16 | +@@ -58,7 +58,7 @@ def translate_config(out_dir, config, v8_config): |
| 17 | + 'llvm_version': 13, |
| 18 | + 'napi_build_version': config['napi_build_version'], |
| 19 | + 'node_builtin_shareable_builtins': |
| 20 | +- eval(config['node_builtin_shareable_builtins']), |
| 21 | ++ json.loads(config['node_builtin_shareable_builtins']), |
| 22 | + 'node_module_version': int(config['node_module_version']), |
| 23 | + 'node_use_openssl': config['node_use_openssl'], |
| 24 | + 'node_use_amaro': config['node_use_amaro'], |
| 25 | +@@ -102,7 +102,8 @@ def main(): |
| 26 | + |
| 27 | + # Write output. |
| 28 | + with open(args.target, 'w') as f: |
| 29 | +- f.write(repr(translate_config(args.out_dir, config, v8_config))) |
| 30 | ++ f.write(json.dumps(translate_config(args.out_dir, config, v8_config), |
| 31 | ++ sort_keys=True)) |
| 32 | + |
| 33 | + # Write depfile. Force regenerating config.gypi when GN configs change. |
| 34 | + if args.dep_file: |
0 commit comments