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

Side by Side Diff: build/android/adb_command_line.py

Issue 1509493003: [Android] Fix environment variable handling in devil_env. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows-friendly environment initialization Created 5 years 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/PRESUBMIT.py ('k') | build/android/devil/devil_env.py » ('j') | 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/python 1 #!/usr/bin/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 """Utility for reading / writing command-line flag files on device(s).""" 6 """Utility for reading / writing command-line flag files on device(s)."""
7 7
8 import argparse 8 import argparse
9 import sys 9 import sys
10 10
11 import devil_chromium
11 from devil.android import device_utils 12 from devil.android import device_utils
12 from devil.android import device_errors 13 from devil.android import device_errors
13 from devil.utils import cmd_helper 14 from devil.utils import cmd_helper
14 15
15 16
16 def main(): 17 def main():
17 parser = argparse.ArgumentParser(description=__doc__) 18 parser = argparse.ArgumentParser(description=__doc__)
18 parser.usage = '''%(prog)s --device-path PATH [--device SERIAL] [flags...] 19 parser.usage = '''%(prog)s --device-path PATH [--device SERIAL] [flags...]
19 20
20 No flags: Prints existing command-line file. 21 No flags: Prints existing command-line file.
21 Empty string: Deletes command-line file. 22 Empty string: Deletes command-line file.
22 Otherwise: Writes command-line file. 23 Otherwise: Writes command-line file.
23 24
24 ''' 25 '''
25 parser.add_argument('-d', '--device', dest='device', 26 parser.add_argument('-d', '--device', dest='device',
26 help='Target device for apk to install on.') 27 help='Target device for apk to install on.')
27 parser.add_argument('--device-path', required=True, 28 parser.add_argument('--device-path', required=True,
28 help='Remote path to flags file.') 29 help='Remote path to flags file.')
29 args, remote_args = parser.parse_known_args() 30 args, remote_args = parser.parse_known_args()
30 31
32 devil_chromium.Initialize()
33
31 as_root = not args.device_path.startswith('/data/local/tmp/') 34 as_root = not args.device_path.startswith('/data/local/tmp/')
32 35
33 if args.device: 36 if args.device:
34 devices = [device_utils.DeviceUtils(args.device, default_retries=0)] 37 devices = [device_utils.DeviceUtils(args.device, default_retries=0)]
35 else: 38 else:
36 devices = device_utils.DeviceUtils.HealthyDevices(default_retries=0) 39 devices = device_utils.DeviceUtils.HealthyDevices(default_retries=0)
37 if not devices: 40 if not devices:
38 raise device_errors.NoDevicesError() 41 raise device_errors.NoDevicesError()
39 42
40 all_devices = device_utils.DeviceUtils.parallel(devices) 43 all_devices = device_utils.DeviceUtils.parallel(devices)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 device.RunShellCommand(['chmod', '0664', args.device_path], as_root=as_root) 77 device.RunShellCommand(['chmod', '0664', args.device_path], as_root=as_root)
75 78
76 all_devices.pMap(write_flags).pGet(None) 79 all_devices.pMap(write_flags).pGet(None)
77 print 'Wrote flags to %s' % args.device_path 80 print 'Wrote flags to %s' % args.device_path
78 print_args() 81 print_args()
79 return 0 82 return 0
80 83
81 84
82 if __name__ == '__main__': 85 if __name__ == '__main__':
83 sys.exit(main()) 86 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/PRESUBMIT.py ('k') | build/android/devil/devil_env.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698