OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2011 the V8 project authors. All rights reserved. | 3 # Copyright 2011 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 if len(files) == 0: | 204 if len(files) == 0: |
205 print 'No changes in files detected. Skipping cpplint check.' | 205 print 'No changes in files detected. Skipping cpplint check.' |
206 return True | 206 return True |
207 | 207 |
208 filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES]) | 208 filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES]) |
209 command = ['cpplint.py', '--filter', filt] + join(files) | 209 command = ['cpplint.py', '--filter', filt] + join(files) |
210 local_cpplint = join(path, "tools", "cpplint.py") | 210 local_cpplint = join(path, "tools", "cpplint.py") |
211 if exists(local_cpplint): | 211 if exists(local_cpplint): |
212 command = ['python', local_cpplint, '--filter', filt] + join(files) | 212 command = ['python', local_cpplint, '--filter', filt] + join(files) |
213 | 213 |
214 process = subprocess.Popen(command, stderr=subprocess.PIPE) | 214 try: |
| 215 process = subprocess.Popen(command, stderr=subprocess.PIPE) |
| 216 except: |
| 217 print('Error running cpplint.py. Please make sure you have depot_tools' + |
| 218 ' in your $PATH. Lint check skipped.') |
| 219 return True |
215 LINT_ERROR_PATTERN = re.compile(r'^(.+)[:(]\d+[:)]') | 220 LINT_ERROR_PATTERN = re.compile(r'^(.+)[:(]\d+[:)]') |
216 while True: | 221 while True: |
217 out_line = process.stderr.readline() | 222 out_line = process.stderr.readline() |
218 if out_line == '' and process.poll() != None: | 223 if out_line == '' and process.poll() != None: |
219 break | 224 break |
220 sys.stderr.write(out_line) | 225 sys.stderr.write(out_line) |
221 m = LINT_ERROR_PATTERN.match(out_line) | 226 m = LINT_ERROR_PATTERN.match(out_line) |
222 if m: | 227 if m: |
223 good_files_cache.RemoveFile(m.group(1)) | 228 good_files_cache.RemoveFile(m.group(1)) |
224 | 229 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 print "Running copyright header and trailing whitespaces check..." | 348 print "Running copyright header and trailing whitespaces check..." |
344 success = SourceProcessor().Run(workspace) and success | 349 success = SourceProcessor().Run(workspace) and success |
345 if success: | 350 if success: |
346 return 0 | 351 return 0 |
347 else: | 352 else: |
348 return 1 | 353 return 1 |
349 | 354 |
350 | 355 |
351 if __name__ == '__main__': | 356 if __name__ == '__main__': |
352 sys.exit(Main()) | 357 sys.exit(Main()) |
OLD | NEW |