Chromium Code Reviews| 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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 823 # Ignore extra files on the device. | 823 # Ignore extra files on the device. |
| 824 if not ignore_filenames: | 824 if not ignore_filenames: |
| 825 host_files = [os.path.relpath(os.path.normpath(p.path), | 825 host_files = [os.path.relpath(os.path.normpath(p.path), |
| 826 os.path.normpath(host_path)) for p in host_hash_tuples] | 826 os.path.normpath(host_path)) for p in host_hash_tuples] |
| 827 | 827 |
| 828 def HostHas(fname): | 828 def HostHas(fname): |
| 829 return any(path in fname for path in host_files) | 829 return any(path in fname for path in host_files) |
| 830 | 830 |
| 831 device_hash_tuples = [h for h in device_hash_tuples if HostHas(h.path)] | 831 device_hash_tuples = [h for h in device_hash_tuples if HostHas(h.path)] |
| 832 | 832 |
| 833 if len(host_hash_tuples) > len(device_hash_tuples): | |
| 834 logging.info('%s files do not exist on the device' % | |
| 835 (len(host_hash_tuples) - len(device_hash_tuples))) | |
|
frankf
2013/09/18 20:12:17
Do you want to log the file names?
| |
| 836 | |
| 833 # Constructs the target device path from a given host path. Don't use when | 837 # Constructs the target device path from a given host path. Don't use when |
| 834 # only a single file is given as the base name given in device_path may | 838 # only a single file is given as the base name given in device_path may |
| 835 # differ from that in host_path. | 839 # differ from that in host_path. |
| 836 def HostToDevicePath(host_file_path): | 840 def HostToDevicePath(host_file_path): |
| 837 return os.path.join(device_path, os.path.relpath( | 841 return os.path.join(device_path, os.path.relpath( |
| 838 host_file_path, os.path.normpath(host_path))) | 842 host_file_path, os.path.normpath(host_path))) |
| 839 | 843 |
| 840 device_hashes = [h.hash for h in device_hash_tuples] | 844 device_hashes = [h.hash for h in device_hash_tuples] |
| 841 return [(t.path, HostToDevicePath(t.path) if os.path.isdir(host_path) else | 845 return [(t.path, HostToDevicePath(t.path) if os.path.isdir(host_path) else |
| 842 device_path) | 846 device_path) |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1570 """ | 1574 """ |
| 1571 def __init__(self, output): | 1575 def __init__(self, output): |
| 1572 self._output = output | 1576 self._output = output |
| 1573 | 1577 |
| 1574 def write(self, data): | 1578 def write(self, data): |
| 1575 data = data.replace('\r\r\n', '\n') | 1579 data = data.replace('\r\r\n', '\n') |
| 1576 self._output.write(data) | 1580 self._output.write(data) |
| 1577 | 1581 |
| 1578 def flush(self): | 1582 def flush(self): |
| 1579 self._output.flush() | 1583 self._output.flush() |
| OLD | NEW |