OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 def Run(self, path): | 185 def Run(self, path): |
186 all_files = [] | 186 all_files = [] |
187 for file in self.GetPathsToSearch(): | 187 for file in self.GetPathsToSearch(): |
188 all_files += self.FindFilesIn(join(path, file)) | 188 all_files += self.FindFilesIn(join(path, file)) |
189 if not self.ProcessFiles(all_files, path): | 189 if not self.ProcessFiles(all_files, path): |
190 return False | 190 return False |
191 return True | 191 return True |
192 | 192 |
193 def IgnoreDir(self, name): | 193 def IgnoreDir(self, name): |
194 return name.startswith('.') or name == 'data' or name == 'sputniktests' | 194 return (name.startswith('.') or |
| 195 name in ('data', 'kraken', 'octane', 'sunspider')) |
195 | 196 |
196 def IgnoreFile(self, name): | 197 def IgnoreFile(self, name): |
197 return name.startswith('.') | 198 return name.startswith('.') |
198 | 199 |
199 def FindFilesIn(self, path): | 200 def FindFilesIn(self, path): |
200 result = [] | 201 result = [] |
201 for (root, dirs, files) in os.walk(path): | 202 for (root, dirs, files) in os.walk(path): |
202 for ignored in [x for x in dirs if self.IgnoreDir(x)]: | 203 for ignored in [x for x in dirs if self.IgnoreDir(x)]: |
203 dirs.remove(ignored) | 204 dirs.remove(ignored) |
204 for file in files: | 205 for file in files: |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 def IsRelevant(self, name): | 306 def IsRelevant(self, name): |
306 for ext in SourceProcessor.RELEVANT_EXTENSIONS: | 307 for ext in SourceProcessor.RELEVANT_EXTENSIONS: |
307 if name.endswith(ext): | 308 if name.endswith(ext): |
308 return True | 309 return True |
309 return False | 310 return False |
310 | 311 |
311 def GetPathsToSearch(self): | 312 def GetPathsToSearch(self): |
312 return ['.'] | 313 return ['.'] |
313 | 314 |
314 def IgnoreDir(self, name): | 315 def IgnoreDir(self, name): |
315 return (super(SourceProcessor, self).IgnoreDir(name) | 316 return (super(SourceProcessor, self).IgnoreDir(name) or |
316 or (name == 'third_party') | 317 name in ('third_party', 'gyp', 'out', 'obj', 'DerivedSources')) |
317 or (name == 'gyp') | |
318 or (name == 'out') | |
319 or (name == 'obj') | |
320 or (name == 'DerivedSources')) | |
321 | 318 |
322 IGNORE_COPYRIGHTS = ['cpplint.py', | 319 IGNORE_COPYRIGHTS = ['cpplint.py', |
323 'daemon.py', | 320 'daemon.py', |
324 'earley-boyer.js', | 321 'earley-boyer.js', |
325 'raytrace.js', | 322 'raytrace.js', |
326 'crypto.js', | 323 'crypto.js', |
327 'libraries.cc', | 324 'libraries.cc', |
328 'libraries-empty.cc', | 325 'libraries-empty.cc', |
329 'jsmin.py', | 326 'jsmin.py', |
330 'regexp-pcre.js', | 327 'regexp-pcre.js', |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 "two empty lines between declarations check..." | 423 "two empty lines between declarations check..." |
427 success = SourceProcessor().Run(workspace) and success | 424 success = SourceProcessor().Run(workspace) and success |
428 if success: | 425 if success: |
429 return 0 | 426 return 0 |
430 else: | 427 else: |
431 return 1 | 428 return 1 |
432 | 429 |
433 | 430 |
434 if __name__ == '__main__': | 431 if __name__ == '__main__': |
435 sys.exit(Main()) | 432 sys.exit(Main()) |
OLD | NEW |