5Copyright 2013 Google Inc.
7Use of this source code is governed by a BSD-style license that can be
8found in the LICENSE file.
12Rewrites a JSON file to use Python's standard JSON pretty-print format,
13so that subsequent runs of rebaseline.py will generate useful diffs
14(only the actual checksum differences will show up as diffs, not obscured
15by format differences).
17Should not modify the JSON contents in any meaningful way.
22from __future__
import print_function
39GM_DIRECTORY = os.path.realpath(
40 os.path.join(os.path.dirname(os.path.dirname(__file__)),
'gm'))
41if GM_DIRECTORY
not in sys.path:
42 sys.path.append(GM_DIRECTORY)
46 print(
'Reformatting file %s...' % filename)
47 gm_json.WriteToFile(gm_json.LoadFromFile(filename), filename)
50 parser = argparse.ArgumentParser(description=
'Reformat JSON files in-place.')
51 parser.add_argument(
'filenames', metavar=
'FILENAME', nargs=
'+',
52 help=
'file to reformat')
53 args = parser.parse_args()
54 for filename
in args.filenames:
58if __name__ ==
'__main__':
def print(*args, **kwargs)