| 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 # pylint: disable-all | 9 # pylint: disable-all |
| 10 | 10 |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 if not os.path.isdir(host_path): | 1079 if not os.path.isdir(host_path): |
| 1080 if host_path in self._push_if_needed_cache: | 1080 if host_path in self._push_if_needed_cache: |
| 1081 host_path_mtime = self._push_if_needed_cache[host_path] | 1081 host_path_mtime = self._push_if_needed_cache[host_path] |
| 1082 if host_path_mtime == os.stat(host_path).st_mtime: | 1082 if host_path_mtime == os.stat(host_path).st_mtime: |
| 1083 return | 1083 return |
| 1084 | 1084 |
| 1085 size = host_utils.GetRecursiveDiskUsage(host_path) | 1085 size = host_utils.GetRecursiveDiskUsage(host_path) |
| 1086 self._pushed_files.append(device_path) | 1086 self._pushed_files.append(device_path) |
| 1087 self._potential_push_size += size | 1087 self._potential_push_size += size |
| 1088 | 1088 |
| 1089 if os.path.isdir(host_path): |
| 1090 self.RunShellCommand('mkdir -p "%s"' % device_path) |
| 1091 |
| 1089 changed_files = self.GetFilesChanged(host_path, device_path) | 1092 changed_files = self.GetFilesChanged(host_path, device_path) |
| 1090 logging.info('Found %d files that need to be pushed to %s', | 1093 logging.info('Found %d files that need to be pushed to %s', |
| 1091 len(changed_files), device_path) | 1094 len(changed_files), device_path) |
| 1092 if not changed_files: | 1095 if not changed_files: |
| 1093 return | 1096 return |
| 1094 | 1097 |
| 1095 def Push(host, device): | 1098 def Push(host, device): |
| 1096 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout | 1099 # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout |
| 1097 # of 60 seconds which isn't sufficient for a lot of users of this method. | 1100 # of 60 seconds which isn't sufficient for a lot of users of this method. |
| 1098 push_command = 'push %s %s' % (host, device) | 1101 push_command = 'push %s %s' % (host, device) |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 """ | 1980 """ |
| 1978 def __init__(self, output): | 1981 def __init__(self, output): |
| 1979 self._output = output | 1982 self._output = output |
| 1980 | 1983 |
| 1981 def write(self, data): | 1984 def write(self, data): |
| 1982 data = data.replace('\r\r\n', '\n') | 1985 data = data.replace('\r\r\n', '\n') |
| 1983 self._output.write(data) | 1986 self._output.write(data) |
| 1984 | 1987 |
| 1985 def flush(self): | 1988 def flush(self): |
| 1986 self._output.flush() | 1989 self._output.flush() |
| OLD | NEW |