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

Side by Side Diff: tools/presubmit.py

Issue 10124006: Fix presubmit check for the case when cpplint fails. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 def CppLintWorker(command): 108 def CppLintWorker(command):
109 try: 109 try:
110 process = subprocess.Popen(command, stderr=subprocess.PIPE) 110 process = subprocess.Popen(command, stderr=subprocess.PIPE)
111 process.wait() 111 process.wait()
112 out_lines = "" 112 out_lines = ""
113 error_count = -1 113 error_count = -1
114 while True: 114 while True:
115 out_line = process.stderr.readline() 115 out_line = process.stderr.readline()
116 if out_line == '' and process.poll() != None: 116 if out_line == '' and process.poll() != None:
117 if error_count == -1:
118 print "Failed to process %s" % command.pop()
119 return 1
117 break 120 break
118 m = LINT_OUTPUT_PATTERN.match(out_line) 121 m = LINT_OUTPUT_PATTERN.match(out_line)
119 if m: 122 if m:
120 out_lines += out_line 123 out_lines += out_line
121 error_count += 1 124 error_count += 1
122 sys.stderr.write(out_lines) 125 sys.stdout.write(out_lines)
123 return error_count 126 return error_count
124 except KeyboardInterrupt: 127 except KeyboardInterrupt:
125 process.kill() 128 process.kill()
126 except: 129 except:
127 print('Error running cpplint.py. Please make sure you have depot_tools' + 130 print('Error running cpplint.py. Please make sure you have depot_tools' +
128 ' in your $PATH. Lint check skipped.') 131 ' in your $PATH. Lint check skipped.')
129 process.kill() 132 process.kill()
130 133
131 134
132 class FileContentsCache(object): 135 class FileContentsCache(object):
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 print "Running copyright header and trailing whitespaces check..." 378 print "Running copyright header and trailing whitespaces check..."
376 success = SourceProcessor().Run(workspace) and success 379 success = SourceProcessor().Run(workspace) and success
377 if success: 380 if success:
378 return 0 381 return 0
379 else: 382 else:
380 return 1 383 return 1
381 384
382 385
383 if __name__ == '__main__': 386 if __name__ == '__main__':
384 sys.exit(Main()) 387 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698