Index: tools/presubmit.py |
=================================================================== |
--- tools/presubmit.py (revision 2838) |
+++ tools/presubmit.py (working copy) |
@@ -30,7 +30,7 @@ |
import optparse |
import os |
-from os.path import abspath, join, dirname, basename |
+from os.path import abspath, join, dirname, basename, exists |
import re |
import sys |
import subprocess |
@@ -103,7 +103,7 @@ |
all_files = [] |
for file in self.GetPathsToSearch(): |
all_files += self.FindFilesIn(join(path, file)) |
- if not self.ProcessFiles(all_files): |
+ if not self.ProcessFiles(all_files, path): |
return False |
return True |
@@ -145,9 +145,12 @@ |
def GetPathsToSearch(self): |
return ['src', 'public', 'samples', join('test', 'cctest')] |
- def ProcessFiles(self, files): |
+ def ProcessFiles(self, files, path): |
filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES]) |
command = ['cpplint.py', '--filter', filt] + join(files) |
+ local_cpplint = join(path, "tools", "cpplint.py") |
+ if exists(local_cpplint): |
+ command = ['python', local_cpplint, '--filter', filt] + join(files) |
Christian Plesner Hansen
2009/09/08 07:48:58
Above we call cpplint.py as the executable, here w
Søren Thygesen Gjesse
2009/09/11 12:30:53
I could not make that work in Windows.
|
process = subprocess.Popen(command) |
return process.wait() == 0 |
@@ -194,7 +197,7 @@ |
result = False |
return result |
- def ProcessFiles(self, files): |
+ def ProcessFiles(self, files, path): |
success = True |
for file in files: |
try: |