| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 """Server for viewing the compiled C++ code from tools/json_schema_compiler. | 6 """Server for viewing the compiled C++ code from tools/json_schema_compiler. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import cc_generator | 9 import cc_generator |
| 10 import code | 10 import code |
| 11 import compiler | |
| 12 import cpp_type_generator | 11 import cpp_type_generator |
| 13 import cpp_util | 12 import cpp_util |
| 14 import h_generator | 13 import h_generator |
| 15 import idl_schema | 14 import idl_schema |
| 16 import json_schema | 15 import json_schema |
| 17 import model | 16 import model |
| 18 import optparse | 17 import optparse |
| 19 import os | 18 import os |
| 20 import schema_loader | 19 import schema_loader |
| 21 import sys | |
| 22 import urlparse | 20 import urlparse |
| 23 from highlighters import ( | 21 from highlighters import ( |
| 24 pygments_highlighter, none_highlighter, hilite_me_highlighter) | 22 pygments_highlighter, none_highlighter, hilite_me_highlighter) |
| 25 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | 23 from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer |
| 26 | 24 |
| 27 class CompilerHandler(BaseHTTPRequestHandler): | 25 class CompilerHandler(BaseHTTPRequestHandler): |
| 28 """A HTTPRequestHandler that outputs the result of tools/json_schema_compiler. | 26 """A HTTPRequestHandler that outputs the result of tools/json_schema_compiler. |
| 29 """ | 27 """ |
| 30 def do_GET(self): | 28 def do_GET(self): |
| 31 parsed_url = urlparse.urlparse(self.path) | 29 parsed_url = urlparse.urlparse(self.path) |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 highlighters['pygments'] = pygments_highlighter.PygmentsHighlighter() | 355 highlighters['pygments'] = pygments_highlighter.PygmentsHighlighter() |
| 358 except ImportError as e: | 356 except ImportError as e: |
| 359 pass | 357 pass |
| 360 | 358 |
| 361 server = PreviewHTTPServer(('', int(opts.port)), | 359 server = PreviewHTTPServer(('', int(opts.port)), |
| 362 CompilerHandler, | 360 CompilerHandler, |
| 363 highlighters) | 361 highlighters) |
| 364 server.serve_forever() | 362 server.serve_forever() |
| 365 except KeyboardInterrupt: | 363 except KeyboardInterrupt: |
| 366 server.socket.close() | 364 server.socket.close() |
| OLD | NEW |