| 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 skypy.paths | 6 import skypy.paths |
| 7 from skypy.skyserver import SkyServer | 7 from skypy.skyserver import SkyServer |
| 8 import argparse | 8 import argparse |
| 9 import json | 9 import json |
| 10 import logging | 10 import logging |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 def _create_paths_for_build_dir(self, build_dir): | 135 def _create_paths_for_build_dir(self, build_dir): |
| 136 # skypy.paths.Paths takes a root-relative build_dir argument. :( | 136 # skypy.paths.Paths takes a root-relative build_dir argument. :( |
| 137 abs_build_dir = os.path.abspath(build_dir) | 137 abs_build_dir = os.path.abspath(build_dir) |
| 138 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT) | 138 root_relative_build_dir = os.path.relpath(abs_build_dir, SRC_ROOT) |
| 139 return skypy.paths.Paths(root_relative_build_dir) | 139 return skypy.paths.Paths(root_relative_build_dir) |
| 140 | 140 |
| 141 def start_command(self, args): | 141 def start_command(self, args): |
| 142 # FIXME: Lame that we use self for a command-specific variable. | 142 # FIXME: Lame that we use self for a command-specific variable. |
| 143 self.paths = self._create_paths_for_build_dir(args.build_dir) | 143 self.paths = self._create_paths_for_build_dir(args.build_dir) |
| 144 | |
| 145 self.stop_command(None) # Quit any existing process. | 144 self.stop_command(None) # Quit any existing process. |
| 146 self.pids = {} # Clear out our pid file. | 145 self.pids = {} # Clear out our pid file. |
| 147 | 146 |
| 147 if not os.path.exists(self.paths.mojo_shell_path): |
| 148 print "mojo_shell not found in build_dir '%s'" % args.build_dir |
| 149 print "Are you sure you sure that's a valid build_dir location?" |
| 150 print "See skydb start --help for more info" |
| 151 sys.exit(2) |
| 152 |
| 148 # FIXME: This is probably not the right way to compute is_android | 153 # FIXME: This is probably not the right way to compute is_android |
| 149 # from the build directory? | 154 # from the build directory? |
| 150 gn_args = gn_args_from_build_dir(args.build_dir) | 155 gn_args = gn_args_from_build_dir(args.build_dir) |
| 151 is_android = 'android_sdk_version' in gn_args | 156 is_android = 'android_sdk_version' in gn_args |
| 152 | 157 |
| 153 sky_server = self.sky_server_for_args(args) | 158 sky_server = self.sky_server_for_args(args) |
| 154 self.pids['sky_server_pid'] = sky_server.start() | 159 self.pids['sky_server_pid'] = sky_server.start() |
| 155 self.pids['sky_server_port'] = sky_server.port | 160 self.pids['sky_server_port'] = sky_server.port |
| 156 self.pids['sky_server_root'] = sky_server.root | 161 self.pids['sky_server_root'] = sky_server.root |
| 157 | 162 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 load_parser.set_defaults(func=self.load_command) | 379 load_parser.set_defaults(func=self.load_command) |
| 375 | 380 |
| 376 args = parser.parse_args() | 381 args = parser.parse_args() |
| 377 args.func(args) | 382 args.func(args) |
| 378 | 383 |
| 379 self._write_pid_file(PID_FILE_PATH, self.pids) | 384 self._write_pid_file(PID_FILE_PATH, self.pids) |
| 380 | 385 |
| 381 | 386 |
| 382 if __name__ == '__main__': | 387 if __name__ == '__main__': |
| 383 SkyDebugger().main() | 388 SkyDebugger().main() |
| OLD | NEW |