OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 a variety of device interactions based on adb. | 5 """Provides a variety of device interactions based on adb. |
6 | 6 |
7 Eventually, this will be based on adb_wrapper. | 7 Eventually, this will be based on adb_wrapper. |
8 """ | 8 """ |
9 # pylint: disable=unused-argument | 9 # pylint: disable=unused-argument |
10 | 10 |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 def _GetChangedFilesImpl(self, host_path, device_path): | 869 def _GetChangedFilesImpl(self, host_path, device_path): |
870 real_host_path = os.path.realpath(host_path) | 870 real_host_path = os.path.realpath(host_path) |
871 try: | 871 try: |
872 real_device_path = self.RunShellCommand( | 872 real_device_path = self.RunShellCommand( |
873 ['realpath', device_path], single_line=True, check_return=True) | 873 ['realpath', device_path], single_line=True, check_return=True) |
874 except device_errors.CommandFailedError: | 874 except device_errors.CommandFailedError: |
875 real_device_path = None | 875 real_device_path = None |
876 if not real_device_path: | 876 if not real_device_path: |
877 return [(host_path, device_path)] | 877 return [(host_path, device_path)] |
878 | 878 |
879 host_checksums = md5sum.CalculateHostMd5Sums([real_host_path]) | 879 try: |
880 device_paths_to_md5 = ( | 880 host_checksums = md5sum.CalculateHostMd5Sums([real_host_path]) |
881 real_device_path if os.path.isfile(real_host_path) | 881 device_paths_to_md5 = ( |
882 else ('%s/%s' % (real_device_path, os.path.relpath(p, real_host_path)) | 882 real_device_path if os.path.isfile(real_host_path) |
883 for p in host_checksums.iterkeys())) | 883 else ('%s/%s' % (real_device_path, os.path.relpath(p, real_host_path)) |
884 device_checksums = md5sum.CalculateDeviceMd5Sums( | 884 for p in host_checksums.iterkeys())) |
885 device_paths_to_md5, self) | 885 device_checksums = md5sum.CalculateDeviceMd5Sums( |
| 886 device_paths_to_md5, self) |
| 887 except EnvironmentError as e: |
| 888 logging.warning('Error calculating md5: %s', e) |
| 889 return [(host_path, device_path)] |
886 | 890 |
887 if os.path.isfile(host_path): | 891 if os.path.isfile(host_path): |
888 host_checksum = host_checksums.get(real_host_path) | 892 host_checksum = host_checksums.get(real_host_path) |
889 device_checksum = device_checksums.get(real_device_path) | 893 device_checksum = device_checksums.get(real_device_path) |
890 if host_checksum != device_checksum: | 894 if host_checksum != device_checksum: |
891 return [(host_path, device_path)] | 895 return [(host_path, device_path)] |
892 else: | 896 else: |
893 return [] | 897 return [] |
894 else: | 898 else: |
895 to_push = [] | 899 to_push = [] |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 blacklist = device_blacklist.ReadBlacklist() | 1611 blacklist = device_blacklist.ReadBlacklist() |
1608 def blacklisted(adb): | 1612 def blacklisted(adb): |
1609 if adb.GetDeviceSerial() in blacklist: | 1613 if adb.GetDeviceSerial() in blacklist: |
1610 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) | 1614 logging.warning('Device %s is blacklisted.', adb.GetDeviceSerial()) |
1611 return True | 1615 return True |
1612 return False | 1616 return False |
1613 | 1617 |
1614 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() | 1618 return [cls(adb) for adb in adb_wrapper.AdbWrapper.Devices() |
1615 if not blacklisted(adb)] | 1619 if not blacklisted(adb)] |
1616 | 1620 |
OLD | NEW |