OLD | NEW |
1 # Copyright (C) 2012 Google Inc. All rights reserved. | 1 # Copyright (C) 2012 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 def _log_info(self, message): | 302 def _log_info(self, message): |
303 _log.info('[%s] %s' % (self._device_serial, message)) | 303 _log.info('[%s] %s' % (self._device_serial, message)) |
304 | 304 |
305 def _log_debug(self, message): | 305 def _log_debug(self, message): |
306 if self._debug_logging: | 306 if self._debug_logging: |
307 _log.debug('[%s] %s' % (self._device_serial, message)) | 307 _log.debug('[%s] %s' % (self._device_serial, message)) |
308 | 308 |
309 @staticmethod | 309 @staticmethod |
310 def _determine_adb_version(adb_command_path, executive, debug_logging): | 310 def _determine_adb_version(adb_command_path, executive, debug_logging): |
311 re_version = re.compile('^.*version ([\d\.]+)$') | 311 re_version = re.compile('^.*version ([\d\.]+)') |
312 try: | 312 try: |
313 output = executive.run_command([adb_command_path, 'version'], error_
handler=executive.ignore_error, | 313 output = executive.run_command([adb_command_path, 'version'], error_
handler=executive.ignore_error, |
314 debug_logging=debug_logging) | 314 debug_logging=debug_logging) |
315 except OSError: | 315 except OSError: |
316 return None | 316 return None |
317 | 317 |
318 result = re_version.match(output) | 318 result = re_version.match(output) |
319 if not output or not result: | 319 if not output or not result: |
320 return None | 320 return None |
321 | 321 |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 return command | 1286 return command |
1287 | 1287 |
1288 def _read_prompt(self, deadline): | 1288 def _read_prompt(self, deadline): |
1289 last_char = '' | 1289 last_char = '' |
1290 while True: | 1290 while True: |
1291 current_char = self._server_process.read_stdout(deadline, 1) | 1291 current_char = self._server_process.read_stdout(deadline, 1) |
1292 if current_char == ' ': | 1292 if current_char == ' ': |
1293 if last_char in ('#', '$'): | 1293 if last_char in ('#', '$'): |
1294 return | 1294 return |
1295 last_char = current_char | 1295 last_char = current_char |
OLD | NEW |