v8/tools/testrunner/utils/dump_build_config.py
Liviu Rau 7aca2b8fd2 [test] Cleanup
Unused imports and some deprecation related updates.

Bug: v8:12785
Change-Id: Ia3998a75f0c3b83eef4134741c1bda5f3d49c6f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3678840
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Liviu Rau <liviurau@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80883}
2022-06-01 09:09:18 +00:00

26 lines
648 B
Python

# Copyright 2016 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Writes a dictionary to a json file with the passed key-value pairs.
Expected to be called like:
dump_build_config.py path/to/file.json [key1=value1 ...]
The values are expected to be valid json. E.g. true is a boolean and "true" is
the string "true".
"""
import json
import sys
assert len(sys.argv) > 2
def as_json(kv):
assert '=' in kv
k, v = kv.split('=', 1)
return k, json.loads(v)
with open(sys.argv[1], 'w') as f:
json.dump(dict(map(as_json, sys.argv[2:])), f)