Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/system/crashlogs.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2011, Google Inc. All rights reserved. 1 # Copyright (c) 2011, 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 logs = self._host.filesystem.files_under(log_directory, file_filter=is_c rash_log) 56 logs = self._host.filesystem.files_under(log_directory, file_filter=is_c rash_log)
57 first_line_regex = re.compile(r'^Process:\s+(?P<process_name>.*) \[(?P<p id>\d+)\]$') 57 first_line_regex = re.compile(r'^Process:\s+(?P<process_name>.*) \[(?P<p id>\d+)\]$')
58 errors = '' 58 errors = ''
59 for path in reversed(sorted(logs)): 59 for path in reversed(sorted(logs)):
60 try: 60 try:
61 if not newer_than or self._host.filesystem.mtime(path) > newer_t han: 61 if not newer_than or self._host.filesystem.mtime(path) > newer_t han:
62 f = self._host.filesystem.read_text_file(path) 62 f = self._host.filesystem.read_text_file(path)
63 match = first_line_regex.match(f[0:f.find('\n')]) 63 match = first_line_regex.match(f[0:f.find('\n')])
64 if match and match.group('process_name') == process_name and (pid is None or int(match.group('pid')) == pid): 64 if match and match.group('process_name') == process_name and (pid is None or int(match.group('pid')) == pid):
65 return errors + f 65 return errors + f
66 except IOError, e: 66 except IOError as e:
67 if include_errors: 67 if include_errors:
68 errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e) ) 68 errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e) )
69 except OSError, e: 69 except OSError as e:
70 if include_errors: 70 if include_errors:
71 errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e) ) 71 errors += "ERROR: Failed to read '%s': %s\n" % (path, str(e) )
72 72
73 if include_errors and errors: 73 if include_errors and errors:
74 return errors 74 return errors
75 return None 75 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698