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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
856 def GetHostSize(path): | 856 def GetHostSize(path): |
857 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) | 857 return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0]) |
858 | 858 |
859 size = GetHostSize(host_path) | 859 size = GetHostSize(host_path) |
860 self._pushed_files.append(device_path) | 860 self._pushed_files.append(device_path) |
861 self._potential_push_size += size | 861 self._potential_push_size += size |
862 | 862 |
863 changed_files = self.GetFilesChanged(host_path, device_path) | 863 changed_files = self.GetFilesChanged(host_path, device_path) |
864 logging.info('Found %d files that need to be pushed to %s', | 864 logging.info('Found %d files that need to be pushed to %s', |
865 len(changed_files), device_path) | 865 len(changed_files), device_path) |
866 logging.info([os.path.relpath(f[0], host_path) for f in changed_files]) | |
frankf
2013/09/17 18:16:25
Why relative path?
| |
866 if not changed_files: | 867 if not changed_files: |
867 return | 868 return |
868 | 869 |
869 def Push(host, device): | 870 def Push(host, device): |
870 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout | 871 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout |
871 # of 60 seconds which isn't sufficient for a lot of users of this method. | 872 # of 60 seconds which isn't sufficient for a lot of users of this method. |
872 push_command = 'push %s %s' % (host, device) | 873 push_command = 'push %s %s' % (host, device) |
873 self._LogShell(push_command) | 874 self._LogShell(push_command) |
874 | 875 |
875 # Retry push with increasing backoff if the device is busy. | 876 # Retry push with increasing backoff if the device is busy. |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1570 """ | 1571 """ |
1571 def __init__(self, output): | 1572 def __init__(self, output): |
1572 self._output = output | 1573 self._output = output |
1573 | 1574 |
1574 def write(self, data): | 1575 def write(self, data): |
1575 data = data.replace('\r\r\n', '\n') | 1576 data = data.replace('\r\r\n', '\n') |
1576 self._output.write(data) | 1577 self._output.write(data) |
1577 | 1578 |
1578 def flush(self): | 1579 def flush(self): |
1579 self._output.flush() | 1580 self._output.flush() |
OLD | NEW |