Skip to content

Commit a1d06cd

Browse files
committed
fix: generate_config_gypi needs to generate valid JSON
nodejs/node#60794
1 parent 6121db2 commit a1d06cd

2 files changed

Lines changed: 35 additions & 0 deletions

File tree

patches/node/.patches

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ src_refactor_module_wrap_cc_to_update_fixedarray_get_params.patch
4444
src_refactor_wasmstreaming_finish_to_accept_a_callback.patch
4545
src_stop_using_v8_propertycallbackinfo_t_this.patch
4646
build_restore_macos_deployment_target_to_12_0.patch
47+
fix_generate_config_gypi_needs_to_generate_valid_json.patch
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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

Comments
 (0)