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 os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 # We should remove the skypy dependencies from this script. | 9 # We should remove the skypy dependencies from this script. |
10 sys.path.append(os.path.abspath(os.path.join(__file__, '../../../sky/tools'))) | 10 sys.path.append(os.path.abspath(os.path.join(__file__, '../../../sky/tools'))) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 '--list', '--short' | 58 '--list', '--short' |
59 ] | 59 ] |
60 config = {} | 60 config = {} |
61 for line in subprocess.check_output(gn_cmd).strip().split('\n'): | 61 for line in subprocess.check_output(gn_cmd).strip().split('\n'): |
62 # FIXME: This doesn't handle = in values. | 62 # FIXME: This doesn't handle = in values. |
63 key, value = line.split(' = ') | 63 key, value = line.split(' = ') |
64 config[key] = value | 64 config[key] = value |
65 return config | 65 return config |
66 | 66 |
67 | 67 |
68 def ensure_assets_are_downloaded(build_dir): | |
69 sky_pkg_dir = os.path.join(build_dir, 'gen', 'dart-pkg', 'sky') | |
70 sky_pkg_lib_dir = os.path.join(sky_pkg_dir, 'lib') | |
71 sky_icons_dir = \ | |
72 os.path.join(sky_pkg_lib_dir, 'assets', 'material-design-icons') | |
73 if not os.path.isdir(sky_icons_dir): | |
74 logging.info('NOTE: sky/assets/material-design-icons missing, ' | |
75 'Running `download_material_design_icons` for you.') | |
76 subprocess.check_call( | |
77 [os.path.join(sky_pkg_lib_dir, 'download_material_design_icons')]) | |
78 | |
79 class SkyDebugger(object): | 68 class SkyDebugger(object): |
80 def __init__(self): | 69 def __init__(self): |
81 self.pids = {} | 70 self.pids = {} |
82 self.paths = None | 71 self.paths = None |
83 | 72 |
84 def _server_root_for_url(self, url_or_path): | 73 def _server_root_for_url(self, url_or_path): |
85 path = os.path.abspath(url_or_path) | 74 path = os.path.abspath(url_or_path) |
86 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT: | 75 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT: |
87 server_root = SRC_ROOT | 76 server_root = SRC_ROOT |
88 else: | 77 else: |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 def start_command(self, args): | 180 def start_command(self, args): |
192 # FIXME: Lame that we use self for a command-specific variable. | 181 # FIXME: Lame that we use self for a command-specific variable. |
193 self.paths = self._create_paths_for_build_dir(args.build_dir) | 182 self.paths = self._create_paths_for_build_dir(args.build_dir) |
194 self.stop_command(None) # Quit any existing process. | 183 self.stop_command(None) # Quit any existing process. |
195 | 184 |
196 # FIXME: This is probably not the right way to compute is_android | 185 # FIXME: This is probably not the right way to compute is_android |
197 # from the build directory? | 186 # from the build directory? |
198 gn_args = gn_args_from_build_dir(self.paths.build_dir) | 187 gn_args = gn_args_from_build_dir(self.paths.build_dir) |
199 is_android = 'android_sdk_version' in gn_args | 188 is_android = 'android_sdk_version' in gn_args |
200 | 189 |
201 ensure_assets_are_downloaded(args.build_dir) | |
202 | |
203 shell_found = True | 190 shell_found = True |
204 if is_android: | 191 if is_android: |
205 apk_path = os.path.join(self.paths.build_dir, 'apks', ANDROID_APK_NA
ME) | 192 apk_path = os.path.join(self.paths.build_dir, 'apks', ANDROID_APK_NA
ME) |
206 if not os.path.exists(apk_path): | 193 if not os.path.exists(apk_path): |
207 print "%s not found in build_dir '%s'" % \ | 194 print "%s not found in build_dir '%s'" % \ |
208 (ANDROID_APK_NAME, os.path.join(args.build_dir, 'apks')) | 195 (ANDROID_APK_NAME, os.path.join(args.build_dir, 'apks')) |
209 shell_found = False | 196 shell_found = False |
210 elif not os.path.exists(self.paths.mojo_shell_path): | 197 elif not os.path.exists(self.paths.mojo_shell_path): |
211 print "mojo_shell not found in build_dir '%s'" % args.build_dir | 198 print "mojo_shell not found in build_dir '%s'" % args.build_dir |
212 shell_found = False | 199 shell_found = False |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 load_parser.set_defaults(func=self.load_command) | 629 load_parser.set_defaults(func=self.load_command) |
643 | 630 |
644 args = parser.parse_args() | 631 args = parser.parse_args() |
645 args.func(args) | 632 args.func(args) |
646 | 633 |
647 self._write_pid_file(PID_FILE_PATH, self.pids) | 634 self._write_pid_file(PID_FILE_PATH, self.pids) |
648 | 635 |
649 | 636 |
650 if __name__ == '__main__': | 637 if __name__ == '__main__': |
651 SkyDebugger().main() | 638 SkyDebugger().main() |
OLD | NEW |