| 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 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 args=(zip_file.name, files)) | 840 args=(zip_file.name, files)) |
| 841 zip_proc.start() | 841 zip_proc.start() |
| 842 zip_proc.join() | 842 zip_proc.join() |
| 843 | 843 |
| 844 zip_on_device = '%s/tmp.zip' % self.GetExternalStoragePath() | 844 zip_on_device = '%s/tmp.zip' % self.GetExternalStoragePath() |
| 845 try: | 845 try: |
| 846 self.adb.Push(zip_file.name, zip_on_device) | 846 self.adb.Push(zip_file.name, zip_on_device) |
| 847 self.RunShellCommand( | 847 self.RunShellCommand( |
| 848 ['unzip', zip_on_device], | 848 ['unzip', zip_on_device], |
| 849 as_root=True, | 849 as_root=True, |
| 850 env={'PATH': '$PATH:%s' % install_commands.BIN_DIR}, | 850 env={'PATH': '%s:$PATH' % install_commands.BIN_DIR}, |
| 851 check_return=True) | 851 check_return=True) |
| 852 finally: | 852 finally: |
| 853 if zip_proc.is_alive(): | 853 if zip_proc.is_alive(): |
| 854 zip_proc.terminate() | 854 zip_proc.terminate() |
| 855 if self.IsOnline(): | 855 if self.IsOnline(): |
| 856 self.RunShellCommand(['rm', zip_on_device], check_return=True) | 856 self.RunShellCommand(['rm', zip_on_device], check_return=True) |
| 857 | 857 |
| 858 @staticmethod | 858 @staticmethod |
| 859 def _CreateDeviceZip(zip_path, host_device_tuples): | 859 def _CreateDeviceZip(zip_path, host_device_tuples): |
| 860 with zipfile.ZipFile(zip_path, 'w') as zip_file: | 860 with zipfile.ZipFile(zip_path, 'w') as zip_file: |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 Returns: | 1366 Returns: |
| 1367 A Parallelizer operating over |devices|. | 1367 A Parallelizer operating over |devices|. |
| 1368 """ | 1368 """ |
| 1369 if not devices: | 1369 if not devices: |
| 1370 devices = adb_wrapper.AdbWrapper.GetDevices() | 1370 devices = adb_wrapper.AdbWrapper.GetDevices() |
| 1371 devices = [d if isinstance(d, cls) else cls(d) for d in devices] | 1371 devices = [d if isinstance(d, cls) else cls(d) for d in devices] |
| 1372 if async: | 1372 if async: |
| 1373 return parallelizer.Parallelizer(devices) | 1373 return parallelizer.Parallelizer(devices) |
| 1374 else: | 1374 else: |
| 1375 return parallelizer.SyncParallelizer(devices) | 1375 return parallelizer.SyncParallelizer(devices) |
| OLD | NEW |