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

Side by Side Diff: tools/presubmit.py

Issue 133443009: A64: Synchronize with r17441. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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 | « tools/gyp/v8.gyp ('k') | tools/run-tests.py » ('j') | 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return (super(CppLintProcessor, self).IgnoreDir(name) 219 return (super(CppLintProcessor, self).IgnoreDir(name)
220 or (name == 'third_party')) 220 or (name == 'third_party'))
221 221
222 IGNORE_LINT = ['flag-definitions.h'] 222 IGNORE_LINT = ['flag-definitions.h']
223 223
224 def IgnoreFile(self, name): 224 def IgnoreFile(self, name):
225 return (super(CppLintProcessor, self).IgnoreFile(name) 225 return (super(CppLintProcessor, self).IgnoreFile(name)
226 or (name in CppLintProcessor.IGNORE_LINT)) 226 or (name in CppLintProcessor.IGNORE_LINT))
227 227
228 def GetPathsToSearch(self): 228 def GetPathsToSearch(self):
229 return ['src', 'preparser', 'include', 'samples', join('test', 'cctest')] 229 return ['src', 'include', 'samples', join('test', 'cctest')]
230 230
231 def GetCpplintScript(self, prio_path): 231 def GetCpplintScript(self, prio_path):
232 for path in [prio_path] + os.environ["PATH"].split(os.pathsep): 232 for path in [prio_path] + os.environ["PATH"].split(os.pathsep):
233 path = path.strip('"') 233 path = path.strip('"')
234 cpplint = os.path.join(path, "cpplint.py") 234 cpplint = os.path.join(path, "cpplint.py")
235 if os.path.isfile(cpplint): 235 if os.path.isfile(cpplint):
236 return cpplint 236 return cpplint
237 237
238 return None 238 return None
239 239
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 276
277 COPYRIGHT_HEADER_PATTERN = re.compile( 277 COPYRIGHT_HEADER_PATTERN = re.compile(
278 r'Copyright [\d-]*20[0-1][0-9] the V8 project authors. All rights reserved.' ) 278 r'Copyright [\d-]*20[0-1][0-9] the V8 project authors. All rights reserved.' )
279 279
280 class SourceProcessor(SourceFileProcessor): 280 class SourceProcessor(SourceFileProcessor):
281 """ 281 """
282 Check that all files include a copyright notice and no trailing whitespaces. 282 Check that all files include a copyright notice and no trailing whitespaces.
283 """ 283 """
284 284
285 RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c', 'SConscript', 285 RELEVANT_EXTENSIONS = ['.js', '.cc', '.h', '.py', '.c',
286 'SConstruct', '.status', '.gyp', '.gypi'] 286 '.status', '.gyp', '.gypi']
287 287
288 # Overwriting the one in the parent class. 288 # Overwriting the one in the parent class.
289 def FindFilesIn(self, path): 289 def FindFilesIn(self, path):
290 if os.path.exists(path+'/.git'): 290 if os.path.exists(path+'/.git'):
291 output = subprocess.Popen('git ls-files --full-name', 291 output = subprocess.Popen('git ls-files --full-name',
292 stdout=PIPE, cwd=path, shell=True) 292 stdout=PIPE, cwd=path, shell=True)
293 result = [] 293 result = []
294 for file in output.stdout.read().split(): 294 for file in output.stdout.read().split():
295 for dir_part in os.path.dirname(file).split(os.sep): 295 for dir_part in os.path.dirname(file).replace(os.sep, '/').split('/'):
296 if self.IgnoreDir(dir_part): 296 if self.IgnoreDir(dir_part):
297 break 297 break
298 else: 298 else:
299 if self.IsRelevant(file) and not self.IgnoreFile(file): 299 if self.IsRelevant(file) and not self.IgnoreFile(file):
300 result.append(join(path, file)) 300 result.append(join(path, file))
301 if output.wait() == 0: 301 if output.wait() == 0:
302 return result 302 return result
303 return super(SourceProcessor, self).FindFilesIn(path) 303 return super(SourceProcessor, self).FindFilesIn(path)
304 304
305 def IsRelevant(self, name): 305 def IsRelevant(self, name):
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 "two empty lines between declarations check..." 426 "two empty lines between declarations check..."
427 success = SourceProcessor().Run(workspace) and success 427 success = SourceProcessor().Run(workspace) and success
428 if success: 428 if success:
429 return 0 429 return 0
430 else: 430 else:
431 return 1 431 return 1
432 432
433 433
434 if __name__ == '__main__': 434 if __name__ == '__main__':
435 sys.exit(Main()) 435 sys.exit(Main())
OLDNEW
« no previous file with comments | « tools/gyp/v8.gyp ('k') | tools/run-tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698