Commit f5864d08 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Use local cpplint.py if it exists.

If there is a local cpplint.py in the tools directory use this instead of any cpplint in the path. This makes it possible to run presubmit checks on Windows by downloading cpplint.py from http://code.google.com/p/google-styleguide/.
Review URL: http://codereview.chromium.org/194039

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2874 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4052dcd3
......@@ -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 @@ class SourceFileProcessor(object):
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 @@ class CppLintProcessor(SourceFileProcessor):
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)
process = subprocess.Popen(command)
return process.wait() == 0
......@@ -194,7 +197,7 @@ class SourceProcessor(SourceFileProcessor):
result = False
return result
def ProcessFiles(self, files):
def ProcessFiles(self, files, path):
success = True
for file in files:
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment