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

Side by Side Diff: build/android/incremental_install/installer.py

Issue 1895163002: 🐠 Use the new DeviceUtils.HealthyDevices(device_arg=) in a few scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « build/android/adb_reverse_forwarder.py ('k') | 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 # 2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Install *_incremental.apk targets as well as their dependent files.""" 7 """Install *_incremental.apk targets as well as their dependent files."""
8 8
9 import argparse 9 import argparse
10 import glob 10 import glob
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 constants.SetBuildType('Debug') 279 constants.SetBuildType('Debug')
280 if args.output_directory: 280 if args.output_directory:
281 constants.SetOutputDirectory(args.output_directory) 281 constants.SetOutputDirectory(args.output_directory)
282 282
283 devil_chromium.Initialize(output_directory=constants.GetOutDirectory()) 283 devil_chromium.Initialize(output_directory=constants.GetOutDirectory())
284 284
285 if args.dont_even_try: 285 if args.dont_even_try:
286 logging.fatal(args.dont_even_try) 286 logging.fatal(args.dont_even_try)
287 return 1 287 return 1
288 288
289 if args.device: 289 # Retries are annoying when commands fail for legitimate reasons. Might want
290 # Retries are annoying when commands fail for legitimate reasons. Might want 290 # to enable them if this is ever used on bots though.
291 # to enable them if this is ever used on bots though. 291 device = device_utils.DeviceUtils.HealthyDevices(
292 device = device_utils.DeviceUtils( 292 device_arg=args.device,
293 args.device, default_retries=0, enable_device_files_cache=True) 293 default_retries=0,
294 else: 294 enable_device_files_cache=True)[0]
295 devices = device_utils.DeviceUtils.HealthyDevices(
296 default_retries=0, enable_device_files_cache=True)
297 if not devices:
298 raise device_errors.NoDevicesError()
299 elif len(devices) == 1:
300 device = devices[0]
301 else:
302 all_devices = device_utils.DeviceUtils.parallel(devices)
303 msg = ('More than one device available.\n'
304 'Use --device=SERIAL to select a device.\n'
305 'Available devices:\n')
306 descriptions = all_devices.pMap(lambda d: d.build_description).pGet(None)
307 for d, desc in zip(devices, descriptions):
308 msg += ' %s (%s)\n' % (d, desc)
309 raise Exception(msg)
310 295
311 apk = apk_helper.ToHelper(args.apk_path) 296 apk = apk_helper.ToHelper(args.apk_path)
312 if args.uninstall: 297 if args.uninstall:
313 Uninstall(device, apk.GetPackageName(), enable_device_cache=args.cache) 298 Uninstall(device, apk.GetPackageName(), enable_device_cache=args.cache)
314 else: 299 else:
315 Install(device, apk, split_globs=args.splits, native_libs=args.native_libs, 300 Install(device, apk, split_globs=args.splits, native_libs=args.native_libs,
316 dex_files=args.dex_files, enable_device_cache=args.cache, 301 dex_files=args.dex_files, enable_device_cache=args.cache,
317 use_concurrency=args.threading, 302 use_concurrency=args.threading,
318 show_proguard_warning=args.show_proguard_warning) 303 show_proguard_warning=args.show_proguard_warning)
319 304
320 305
321 if __name__ == '__main__': 306 if __name__ == '__main__':
322 sys.exit(main()) 307 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/adb_reverse_forwarder.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698