Revision: 2874 Author: [email protected] Date: Fri Sep 11 05:21:48 2009 Log: 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 http://code.google.com/p/v8/source/detail?r=2874 Modified: /branches/bleeding_edge/tools/presubmit.py ======================================= --- /branches/bleeding_edge/tools/presubmit.py Thu Apr 9 13:07:30 2009 +++ /branches/bleeding_edge/tools/presubmit.py Fri Sep 11 05:21:48 2009 @@ -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) 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: --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
