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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 def GetHostSize(path): | 870 def GetHostSize(path): |
871 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) | 871 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) |
872 | 872 |
873 size = GetHostSize(host_path) | 873 size = GetHostSize(host_path) |
874 self._pushed_files.append(device_path) | 874 self._pushed_files.append(device_path) |
875 self._potential_push_size += size | 875 self._potential_push_size += size |
876 | 876 |
877 changed_files = self.GetFilesChanged(host_path, device_path) | 877 changed_files = self.GetFilesChanged(host_path, device_path) |
878 logging.info('Found %d files that need to be pushed to %s', | 878 logging.info('Found %d files that need to be pushed to %s', |
879 len(changed_files), device_path) | 879 len(changed_files), device_path) |
880 logging.info([os.path.relpath(f[0], host_path) for f in changed_files]) | |
881 if not changed_files: | 880 if not changed_files: |
882 return | 881 return |
883 | 882 |
884 def Push(host, device): | 883 def Push(host, device): |
885 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout | 884 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout |
886 # of 60 seconds which isn't sufficient for a lot of users of this method. | 885 # of 60 seconds which isn't sufficient for a lot of users of this method. |
887 push_command = 'push %s %s' % (host, device) | 886 push_command = 'push %s %s' % (host, device) |
888 self._LogShell(push_command) | 887 self._LogShell(push_command) |
889 | 888 |
890 # Retry push with increasing backoff if the device is busy. | 889 # Retry push with increasing backoff if the device is busy. |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 """ | 1640 """ |
1642 def __init__(self, output): | 1641 def __init__(self, output): |
1643 self._output = output | 1642 self._output = output |
1644 | 1643 |
1645 def write(self, data): | 1644 def write(self, data): |
1646 data = data.replace('\r\r\n', '\n') | 1645 data = data.replace('\r\r\n', '\n') |
1647 self._output.write(data) | 1646 self._output.write(data) |
1648 | 1647 |
1649 def flush(self): | 1648 def flush(self): |
1650 self._output.flush() | 1649 self._output.flush() |
OLD | NEW |