OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 """Gets and writes the configurations of the attached devices. | 7 """Gets and writes the configurations of the attached devices. |
8 | 8 |
9 This configuration is used by later build steps to determine which devices to | 9 This configuration is used by later build steps to determine which devices to |
10 install to and what needs to be installed to those devices. | 10 install to and what needs to be installed to those devices. |
11 """ | 11 """ |
12 | 12 |
13 import optparse | 13 import optparse |
| 14 import os |
14 import sys | 15 import sys |
15 | 16 |
| 17 from util import build_device |
16 from util import build_utils | 18 from util import build_utils |
17 from util import build_device | 19 |
| 20 BUILD_ANDROID_DIR = os.path.abspath( |
| 21 os.path.join(os.path.dirname(__file__), '..')) |
| 22 sys.path.apend(BUILD_ANDROID_DIR) |
| 23 |
| 24 import devil_chromium |
18 | 25 |
19 | 26 |
20 def main(argv): | 27 def main(argv): |
21 parser = optparse.OptionParser() | 28 parser = optparse.OptionParser() |
22 parser.add_option('--stamp', action='store') | 29 parser.add_option('--stamp', action='store') |
23 parser.add_option('--output', action='store') | 30 parser.add_option('--output', action='store') |
| 31 parser.add_option('--output-directory', action='store') |
24 options, _ = parser.parse_args(argv) | 32 options, _ = parser.parse_args(argv) |
25 | 33 |
| 34 devil_chromium.Initialize( |
| 35 output_directory=os.path.abspath(options.output_directory)) |
| 36 |
26 devices = build_device.GetAttachedDevices() | 37 devices = build_device.GetAttachedDevices() |
27 | 38 |
28 device_configurations = [] | 39 device_configurations = [] |
29 for d in devices: | 40 for d in devices: |
30 configuration, is_online, has_root = ( | 41 configuration, is_online, has_root = ( |
31 build_device.GetConfigurationForDevice(d)) | 42 build_device.GetConfigurationForDevice(d)) |
32 | 43 |
33 if not is_online: | 44 if not is_online: |
34 build_utils.PrintBigWarning( | 45 build_utils.PrintBigWarning( |
35 '%s is not online. Skipping managed install for this device. ' | 46 '%s is not online. Skipping managed install for this device. ' |
(...skipping 22 matching lines...) Expand all Loading... |
58 'Multiple devices attached. ' | 69 'Multiple devices attached. ' |
59 'Installing to the preferred device: ' | 70 'Installing to the preferred device: ' |
60 '%(id)s (%(description)s)' % (device_configurations[0])) | 71 '%(id)s (%(description)s)' % (device_configurations[0])) |
61 | 72 |
62 | 73 |
63 build_device.WriteConfigurations(device_configurations, options.output) | 74 build_device.WriteConfigurations(device_configurations, options.output) |
64 | 75 |
65 | 76 |
66 if __name__ == '__main__': | 77 if __name__ == '__main__': |
67 sys.exit(main(sys.argv)) | 78 sys.exit(main(sys.argv)) |
OLD | NEW |