Skip to content

Commit

Permalink
tools: fix config serialization w/ long strings
Browse files Browse the repository at this point in the history
So that “config.gypi” gets serialized correctly in cases such as:

    ./configure --v8-options='--write-protect-code-memory \
    --wasm-write-protect-code-memory'

Where “v8_options” gets prettyprinted into a multiline string.

PR-URL: #35982
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
oleavr authored and codebytere committed Nov 22, 2020
1 parent a81dc9a commit 49649a4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/js2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ def handle_config_gypi(config_filename):
def jsonify(config):
# 1. string comments
config = re.sub(r'#.*?\n', '', config)
# 2. join multiline strings
config = re.sub(r"'$\s+'", '', config, flags=re.M)
# 3. normalize string literals from ' into "
config = re.sub('\'', '"', config)
# 2. turn pseudo-booleans strings into Booleans
# 4. turn pseudo-booleans strings into Booleans
config = re.sub('"true"', 'true', config)
config = re.sub('"false"', 'false', config)
return config
Expand Down

0 comments on commit 49649a4

Please sign in to comment.