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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
811 def _GetChangedFilesImpl(self, host_path, device_path): | 811 def _GetChangedFilesImpl(self, host_path, device_path): |
812 real_host_path = os.path.realpath(host_path) | 812 real_host_path = os.path.realpath(host_path) |
813 try: | 813 try: |
814 real_device_path = self.RunShellCommand( | 814 real_device_path = self.RunShellCommand( |
815 ['realpath', device_path], single_line=True, check_return=True) | 815 ['realpath', device_path], single_line=True, check_return=True) |
816 except device_errors.CommandFailedError: | 816 except device_errors.CommandFailedError: |
817 real_device_path = None | 817 real_device_path = None |
818 if not real_device_path: | 818 if not real_device_path: |
819 return [(host_path, device_path)] | 819 return [(host_path, device_path)] |
820 | 820 |
821 host_hash_tuples = md5sum.CalculateHostMd5Sums([real_host_path]) | 821 try: |
822 host_hash_tuples = md5sum.CalculateHostMd5Sums([real_host_path]) | |
823 except EnvironmentError: | |
824 logging.info('md5sum_bin_host might not be built, ' | |
perezju
2015/04/14 10:45:29
maybe logging.warning, and include the exception m
mikecase (-- gone --)
2015/04/14 16:18:38
Done.
| |
825 'or we might not be able to find it.') | |
826 return [(host_path, device_path)] | |
827 | |
822 device_paths_to_md5 = ( | 828 device_paths_to_md5 = ( |
823 real_device_path if os.path.isfile(real_host_path) | 829 real_device_path if os.path.isfile(real_host_path) |
824 else ('%s/%s' % (real_device_path, os.path.relpath(p, real_host_path)) | 830 else ('%s/%s' % (real_device_path, os.path.relpath(p, real_host_path)) |
825 for _, p in host_hash_tuples)) | 831 for _, p in host_hash_tuples)) |
826 device_hash_tuples = md5sum.CalculateDeviceMd5Sums( | 832 device_hash_tuples = md5sum.CalculateDeviceMd5Sums( |
perezju
2015/04/14 10:45:29
I guess we also want this wrapped on a similar try
| |
827 device_paths_to_md5, self) | 833 device_paths_to_md5, self) |
828 | 834 |
829 if os.path.isfile(host_path): | 835 if os.path.isfile(host_path): |
830 if (not device_hash_tuples | 836 if (not device_hash_tuples |
831 or device_hash_tuples[0].hash != host_hash_tuples[0].hash): | 837 or device_hash_tuples[0].hash != host_hash_tuples[0].hash): |
832 return [(host_path, device_path)] | 838 return [(host_path, device_path)] |
833 else: | 839 else: |
834 return [] | 840 return [] |
835 else: | 841 else: |
836 device_tuple_dict = dict((d.path, d.hash) for d in device_hash_tuples) | 842 device_tuple_dict = dict((d.path, d.hash) for d in device_hash_tuples) |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1531 """Returns client cache.""" | 1537 """Returns client cache.""" |
1532 if client_name not in self._client_caches: | 1538 if client_name not in self._client_caches: |
1533 self._client_caches[client_name] = {} | 1539 self._client_caches[client_name] = {} |
1534 return self._client_caches[client_name] | 1540 return self._client_caches[client_name] |
1535 | 1541 |
1536 def _ClearCache(self): | 1542 def _ClearCache(self): |
1537 """Clears all caches.""" | 1543 """Clears all caches.""" |
1538 for client in self._client_caches: | 1544 for client in self._client_caches: |
1539 self._client_caches[client].clear() | 1545 self._client_caches[client].clear() |
1540 self._cache.clear() | 1546 self._cache.clear() |
OLD | NEW |