| 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 """Pushes native libraries to a device. | 7 """Pushes native libraries to a device. |
| 8 | 8 |
| 9 """ | 9 """ |
| 10 | 10 |
| 11 import json | |
| 12 import optparse | 11 import optparse |
| 13 import os | 12 import os |
| 14 import sys | 13 import sys |
| 15 | 14 |
| 16 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), os.pardir) | 15 BUILD_ANDROID_DIR = os.path.join(os.path.dirname(__file__), os.pardir) |
| 17 sys.path.append(BUILD_ANDROID_DIR) | 16 sys.path.append(BUILD_ANDROID_DIR) |
| 18 | 17 |
| 19 from pylib import constants | 18 from pylib import constants |
| 20 | 19 |
| 20 # pylint: disable=F0401 |
| 21 from util import build_device | 21 from util import build_device |
| 22 from util import build_utils | 22 from util import build_utils |
| 23 from util import md5_check | 23 from util import md5_check |
| 24 # pylint: disable=F0401 |
| 24 | 25 |
| 25 def DoPush(options): | 26 def DoPush(options): |
| 26 libraries = build_utils.ReadJson(options.libraries_json) | 27 libraries = build_utils.ReadJson(options.libraries_json) |
| 27 | 28 |
| 28 device = build_device.GetBuildDeviceFromPath( | 29 device = build_device.GetBuildDeviceFromPath( |
| 29 options.build_device_configuration) | 30 options.build_device_configuration) |
| 30 if not device: | 31 if not device: |
| 31 return | 32 return |
| 32 | 33 |
| 33 serial_number = device.GetSerialNumber() | 34 serial_number = device.GetSerialNumber() |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 device.PushIfNeeded(host_path, device_path) | 45 device.PushIfNeeded(host_path, device_path) |
| 45 | 46 |
| 46 record_path = '%s.%s.push.md5.stamp' % (host_path, serial_number) | 47 record_path = '%s.%s.push.md5.stamp' % (host_path, serial_number) |
| 47 md5_check.CallAndRecordIfStale( | 48 md5_check.CallAndRecordIfStale( |
| 48 Push, | 49 Push, |
| 49 record_path=record_path, | 50 record_path=record_path, |
| 50 input_paths=[host_path], | 51 input_paths=[host_path], |
| 51 input_strings=[device_path]) | 52 input_strings=[device_path]) |
| 52 | 53 |
| 53 | 54 |
| 54 def main(argv): | 55 def main(): |
| 55 parser = optparse.OptionParser() | 56 parser = optparse.OptionParser() |
| 56 parser.add_option('--libraries-dir', | 57 parser.add_option('--libraries-dir', |
| 57 help='Directory that contains stripped libraries.') | 58 help='Directory that contains stripped libraries.') |
| 58 parser.add_option('--device-dir', | 59 parser.add_option('--device-dir', |
| 59 help='Device directory to push the libraries to.') | 60 help='Device directory to push the libraries to.') |
| 60 parser.add_option('--libraries-json', | 61 parser.add_option('--libraries-json', |
| 61 help='Path to the json list of native libraries.') | 62 help='Path to the json list of native libraries.') |
| 62 parser.add_option('--stamp', help='Path to touch on success.') | 63 parser.add_option('--stamp', help='Path to touch on success.') |
| 63 parser.add_option('--build-device-configuration', | 64 parser.add_option('--build-device-configuration', |
| 64 help='Path to build device configuration.') | 65 help='Path to build device configuration.') |
| 65 parser.add_option('--configuration-name', | 66 parser.add_option('--configuration-name', |
| 66 help='The build CONFIGURATION_NAME') | 67 help='The build CONFIGURATION_NAME') |
| 67 options, _ = parser.parse_args() | 68 options, _ = parser.parse_args() |
| 68 | 69 |
| 69 required_options = ['libraries_dir', 'device_dir', 'libraries_json'] | 70 required_options = ['libraries_dir', 'device_dir', 'libraries_json'] |
| 70 build_utils.CheckOptions(options, parser, required=required_options) | 71 build_utils.CheckOptions(options, parser, required=required_options) |
| 71 constants.SetBuildType(options.configuration_name) | 72 constants.SetBuildType(options.configuration_name) |
| 72 | 73 |
| 73 DoPush(options) | 74 DoPush(options) |
| 74 | 75 |
| 75 if options.stamp: | 76 if options.stamp: |
| 76 build_utils.Touch(options.stamp) | 77 build_utils.Touch(options.stamp) |
| 77 | 78 |
| 78 | 79 |
| 79 if __name__ == '__main__': | 80 if __name__ == '__main__': |
| 80 sys.exit(main(sys.argv)) | 81 sys.exit(main()) |
| OLD | NEW |