| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return subprocess.check_output(pm_path_cmd).strip() != '' | 128 return subprocess.check_output(pm_path_cmd).strip() != '' |
| 129 | 129 |
| 130 def run(self, args, pids): | 130 def run(self, args, pids): |
| 131 StopSky().run(args, pids) | 131 StopSky().run(args, pids) |
| 132 | 132 |
| 133 project_or_path = os.path.abspath(args.project_or_path) | 133 project_or_path = os.path.abspath(args.project_or_path) |
| 134 | 134 |
| 135 if os.path.isdir(project_or_path): | 135 if os.path.isdir(project_or_path): |
| 136 sky_server_root = project_or_path | 136 sky_server_root = project_or_path |
| 137 main_dart = os.path.join(project_or_path, 'lib', 'main.dart') | 137 main_dart = os.path.join(project_or_path, 'lib', 'main.dart') |
| 138 missing_msg = "Missing lib/main.dart in project: %s" % project_dir | 138 missing_msg = "Missing lib/main.dart in project: %s" % project_or_pa
th |
| 139 else: | 139 else: |
| 140 # FIXME: This assumes the path is at the root of the project! | 140 # FIXME: This assumes the path is at the root of the project! |
| 141 # Instead we should walk up looking for a pubspec.yaml | 141 # Instead we should walk up looking for a pubspec.yaml |
| 142 sky_server_root = os.path.dirname(project_or_path) | 142 sky_server_root = os.path.dirname(project_or_path) |
| 143 main_dart = project_or_path | 143 main_dart = project_or_path |
| 144 missing_msg = "%s does not exist." % main_dart | 144 missing_msg = "%s does not exist." % main_dart |
| 145 | 145 |
| 146 if not os.path.isfile(main_dart): | 146 if not os.path.isfile(main_dart): |
| 147 print missing_msg | 147 print missing_msg |
| 148 return 2 | 148 return 2 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 args = parser.parse_args() | 308 args = parser.parse_args() |
| 309 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS) | 309 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS) |
| 310 exit_code = args.func(args, pids) | 310 exit_code = args.func(args, pids) |
| 311 # We could do this with an at-exit handler instead? | 311 # We could do this with an at-exit handler instead? |
| 312 pids.write_to(PID_FILE_PATH) | 312 pids.write_to(PID_FILE_PATH) |
| 313 sys.exit(exit_code) | 313 sys.exit(exit_code) |
| 314 | 314 |
| 315 | 315 |
| 316 if __name__ == '__main__': | 316 if __name__ == '__main__': |
| 317 SkyShellRunner().main() | 317 SkyShellRunner().main() |
| OLD | NEW |