Output json without trailing whitespaces but with trailing newlines.

Makes them more editor friendly, primarily when copied into
system/linkerconfig/testdata/root.

Test: m
Test: No diff between apex_manifest_full.json in out/
  and in linkerconfig/testdata/root/
Bug: 140599044
Change-Id: I6dacdd4baa59e6d70586c4a6343b9b8fd1b574f6
This commit is contained in:
Martin Stjernholm 2020-02-24 15:52:31 +00:00
parent efbce1cace
commit 37fa32ce94

View file

@ -112,9 +112,10 @@ def main():
if args.out:
with open(args.out, "w") as f:
json.dump(obj, f, indent=2)
json.dump(obj, f, indent=2, separators=(',', ': '))
f.write('\n')
else:
print(json.dumps(obj, indent=2))
print(json.dumps(obj, indent=2, separators=(',', ': ')))
if __name__ == '__main__':