OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Provides an interface to communicate with the device via the adb command. | 5 """Provides an interface to communicate with the device via the adb command. |
6 | 6 |
7 Assumes adb binary is currently on system path. | 7 Assumes adb binary is currently on system path. |
8 """ | 8 """ |
9 | 9 |
10 import collections | 10 import collections |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 All pushed files can be removed by calling RemovePushedFiles(). | 611 All pushed files can be removed by calling RemovePushedFiles(). |
612 """ | 612 """ |
613 assert os.path.exists(local_path), 'Local path not found %s' % local_path | 613 assert os.path.exists(local_path), 'Local path not found %s' % local_path |
614 | 614 |
615 if not self._md5sum_path: | 615 if not self._md5sum_path: |
616 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') | 616 default_build_type = os.environ.get('BUILD_TYPE', 'Debug') |
617 md5sum_path = '%s/%s/md5sum_bin' % (cmd_helper.OutDirectory.get(), | 617 md5sum_path = '%s/%s/md5sum_bin' % (cmd_helper.OutDirectory.get(), |
618 default_build_type) | 618 default_build_type) |
619 if not os.path.exists(md5sum_path): | 619 if not os.path.exists(md5sum_path): |
620 md5sum_path = '%s/Release/md5sum_bin' % cmd_helper.OutDirectory.get() | 620 md5sum_path = '%s/Release/md5sum_bin' % cmd_helper.OutDirectory.get() |
621 if not os.path.exists(md5sum_path): | 621 assert os.path.exists(md5sum_path), 'Please build md5sum.' |
622 print >> sys.stderr, 'Please build md5sum.' | |
623 sys.exit(1) | |
624 command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH) | 622 command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH) |
625 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) | 623 assert _HasAdbPushSucceeded(self._adb.SendCommand(command)) |
626 self._md5sum_path = md5sum_path | 624 self._md5sum_path = md5sum_path |
627 | 625 |
628 self._pushed_files.append(device_path) | 626 self._pushed_files.append(device_path) |
629 hashes_on_device = _ComputeFileListHash( | 627 hashes_on_device = _ComputeFileListHash( |
630 self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path)) | 628 self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path)) |
631 assert os.path.exists(local_path), 'Local path not found %s' % local_path | 629 assert os.path.exists(local_path), 'Local path not found %s' % local_path |
632 hashes_on_host = _ComputeFileListHash( | 630 hashes_on_host = _ComputeFileListHash( |
633 subprocess.Popen( | 631 subprocess.Popen( |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 """ | 1110 """ |
1113 def __init__(self, output): | 1111 def __init__(self, output): |
1114 self._output = output | 1112 self._output = output |
1115 | 1113 |
1116 def write(self, data): | 1114 def write(self, data): |
1117 data = data.replace('\r\r\n', '\n') | 1115 data = data.replace('\r\r\n', '\n') |
1118 self._output.write(data) | 1116 self._output.write(data) |
1119 | 1117 |
1120 def flush(self): | 1118 def flush(self): |
1121 self._output.flush() | 1119 self._output.flush() |
OLD | NEW |