| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import codecs | 7 import codecs |
| 8 import sys | 8 import sys |
| 9 import os | 9 import os |
| 10 | 10 |
| 11 tracing_path = os.path.abspath(os.path.join( | 11 tracing_path = os.path.abspath(os.path.join( |
| 12 os.path.dirname(os.path.realpath(__file__)), '..')) | 12 os.path.dirname(os.path.realpath(__file__)), '..')) |
| 13 sys.path.append(tracing_path) | 13 sys.path.append(tracing_path) |
| 14 from tracing import results_renderer | 14 from tracing import results_renderer |
| 15 | 15 |
| 16 | 16 |
| 17 def main(): | 17 def main(): |
| 18 parser = argparse.ArgumentParser(description='Upgrade a results2 instance or ' | 18 parser = argparse.ArgumentParser( |
| 19 'add a new ValueSet JSON.', add_help=False) | 19 description='Upgrade a results2 instance or add a new HistogramSet.', |
| 20 add_help=False) |
| 20 parser.add_argument('html_path', metavar='HTML_PATH', | 21 parser.add_argument('html_path', metavar='HTML_PATH', |
| 21 help='HTML file path (output).') | 22 help='HTML file path (output).') |
| 22 parser.add_argument('-h', '--help', action='help', | 23 parser.add_argument('-h', '--help', action='help', |
| 23 help='Show this help message and exit.') | 24 help='Show this help message and exit.') |
| 24 args = parser.parse_args() | 25 args = parser.parse_args() |
| 25 | 26 |
| 26 open(args.html_path, 'a').close() # Create file if it doesn't exist. | 27 open(args.html_path, 'a').close() # Create file if it doesn't exist. |
| 27 with codecs.open(args.html_path, | 28 with codecs.open(args.html_path, |
| 28 mode='r+', encoding='utf-8') as output_stream: | 29 mode='r+', encoding='utf-8') as output_stream: |
| 29 results_renderer.RenderHTMLView([], output_stream) | 30 results_renderer.RenderHTMLView([], output_stream) |
| 30 | 31 |
| 31 if __name__ == '__main__': | 32 if __name__ == '__main__': |
| 32 sys.exit(main()) | 33 sys.exit(main()) |
| OLD | NEW |