| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 logging | 7 import logging |
| 8 import sys | 8 import sys |
| 9 | 9 |
| 10 from devtoolslib import shell_arguments | 10 from devtoolslib import shell_arguments |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 shell_config.add_shell_arguments(parser) | 58 shell_config.add_shell_arguments(parser) |
| 59 | 59 |
| 60 parser.add_argument('--no-debugger', action="store_true", | 60 parser.add_argument('--no-debugger', action="store_true", |
| 61 help='Do not spawn mojo:debugger.') | 61 help='Do not spawn mojo:debugger.') |
| 62 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER, | 62 parser.add_argument('--window-manager', default=_DEFAULT_WINDOW_MANAGER, |
| 63 help='Window manager app to be mapped as ' | 63 help='Window manager app to be mapped as ' |
| 64 'mojo:window_manager. By default it is ' + | 64 'mojo:window_manager. By default it is ' + |
| 65 _DEFAULT_WINDOW_MANAGER) | 65 _DEFAULT_WINDOW_MANAGER) |
| 66 | 66 |
| 67 script_args, shell_args = parser.parse_known_args() | 67 script_args, shell_args = parser.parse_known_args() |
| 68 config = shell_config.get_shell_config(script_args) | |
| 69 | 68 |
| 70 try: | 69 try: |
| 70 config = shell_config.get_shell_config(script_args) |
| 71 shell, shell_args = shell_arguments.get_shell(config, shell_args) | 71 shell, shell_args = shell_arguments.get_shell(config, shell_args) |
| 72 except shell_arguments.ShellConfigurationException as e: | 72 except shell_config.ShellConfigurationException as e: |
| 73 print e | 73 print e |
| 74 return 1 | 74 return 1 |
| 75 | 75 |
| 76 if not script_args.no_debugger: | 76 if not script_args.no_debugger: |
| 77 if script_args.verbose: | 77 if script_args.verbose: |
| 78 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' | 78 print 'Spawning mojo:debugger, use `mojo_debug` to inspect the shell.' |
| 79 print 'Note that mojo:debugger will prevent the shell from terminating,' | 79 print 'Note that mojo:debugger will prevent the shell from terminating,' |
| 80 print ' pass --no-debugger to skip spawning mojo:debugger.' | 80 print ' pass --no-debugger to skip spawning mojo:debugger.' |
| 81 shell_args.extend(_configure_debugger(shell)) | 81 shell_args.extend(_configure_debugger(shell)) |
| 82 | 82 |
| 83 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=', | 83 shell_args = shell_arguments.append_to_argument(shell_args, '--url-mappings=', |
| 84 'mojo:window_manager=%s' % | 84 'mojo:window_manager=%s' % |
| 85 script_args.window_manager) | 85 script_args.window_manager) |
| 86 | 86 |
| 87 if script_args.verbose: | 87 if script_args.verbose: |
| 88 print "Shell arguments: " + str(shell_args) | 88 print "Shell arguments: " + str(shell_args) |
| 89 | 89 |
| 90 shell.run(shell_args) | 90 shell.run(shell_args) |
| 91 return 0 | 91 return 0 |
| 92 | 92 |
| 93 | 93 |
| 94 if __name__ == "__main__": | 94 if __name__ == "__main__": |
| 95 sys.exit(main()) | 95 sys.exit(main()) |
| OLD | NEW |