Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: sky/tools/shelldb

Issue 1002123003: Add a --no_install option to shelldb (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 from skypy.skyserver import SkyServer 6 from skypy.skyserver import SkyServer
7 import argparse 7 import argparse
8 import json 8 import json
9 import logging 9 import logging
10 import os 10 import os
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 return _convert_to_sky_url(url) 106 return _convert_to_sky_url(url)
107 107
108 108
109 class StartSky(object): 109 class StartSky(object):
110 def add_subparser(self, subparsers): 110 def add_subparser(self, subparsers):
111 start_parser = subparsers.add_parser('start', 111 start_parser = subparsers.add_parser('start',
112 help='launch SKyShell.apk on the device') 112 help='launch SKyShell.apk on the device')
113 start_parser.add_argument('build_dir', type=str) 113 start_parser.add_argument('build_dir', type=str)
114 start_parser.add_argument('url_or_path', nargs='?', type=str, 114 start_parser.add_argument('url_or_path', nargs='?', type=str,
115 default=DEFAULT_URL) 115 default=DEFAULT_URL)
116 start_parser.add_argument('--no_install', action="store_false",
117 default=True, dest="install",
118 help="Don't install SkyDemo.apk before starting")
116 start_parser.set_defaults(func=self.run) 119 start_parser.set_defaults(func=self.run)
117 120
118 def _server_root_for_url(self, url_or_path): 121 def _server_root_for_url(self, url_or_path):
119 path = os.path.abspath(url_or_path) 122 path = os.path.abspath(url_or_path)
120 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT: 123 if os.path.commonprefix([path, SRC_ROOT]) == SRC_ROOT:
121 server_root = SRC_ROOT 124 server_root = SRC_ROOT
122 else: 125 else:
123 server_root = os.path.dirname(path) 126 server_root = os.path.dirname(path)
124 logging.warn( 127 logging.warn(
125 '%s is outside of mojo root, using %s as server root' % 128 '%s is outside of mojo root, using %s as server root' %
(...skipping 26 matching lines...) Expand all
152 sdk_root, 155 sdk_root,
153 ]) 156 ])
154 157
155 sky_server = self._sky_server_for_args(args, packages_root) 158 sky_server = self._sky_server_for_args(args, packages_root)
156 pids['sky_server_pid'] = sky_server.start() 159 pids['sky_server_pid'] = sky_server.start()
157 pids['sky_server_port'] = sky_server.port 160 pids['sky_server_port'] = sky_server.port
158 pids['sky_server_root'] = sky_server.root 161 pids['sky_server_root'] = sky_server.root
159 162
160 pids['build_dir'] = os.path.abspath(args.build_dir) 163 pids['build_dir'] = os.path.abspath(args.build_dir)
161 164
162 subprocess.check_call([ADB_PATH, 'install', '-r', apk_path]) 165 if args.install:
166 subprocess.check_call([ADB_PATH, 'install', '-r', apk_path])
163 167
164 port_string = 'tcp:%s' % sky_server.port 168 port_string = 'tcp:%s' % sky_server.port
165 subprocess.check_call([ 169 subprocess.check_call([
166 ADB_PATH, 'reverse', port_string, port_string 170 ADB_PATH, 'reverse', port_string, port_string
167 ]) 171 ])
168 pids['remote_sky_server_port'] = sky_server.port 172 pids['remote_sky_server_port'] = sky_server.port
169 173
170 subprocess.check_call([ADB_PATH, 'shell', 174 subprocess.check_call([ADB_PATH, 'shell',
171 'am', 'start', 175 'am', 'start',
172 '-a', 'android.intent.action.VIEW', 176 '-a', 'android.intent.action.VIEW',
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 args = parser.parse_args() 294 args = parser.parse_args()
291 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS) 295 pids = Pids.read_from(PID_FILE_PATH, PID_FILE_KEYS)
292 exit_code = args.func(args, pids) 296 exit_code = args.func(args, pids)
293 # We could do this with an at-exit handler instead? 297 # We could do this with an at-exit handler instead?
294 pids.write_to(PID_FILE_PATH) 298 pids.write_to(PID_FILE_PATH)
295 sys.exit(exit_code) 299 sys.exit(exit_code)
296 300
297 301
298 if __name__ == '__main__': 302 if __name__ == '__main__':
299 SkyShellRunner().main() 303 SkyShellRunner().main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698