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

Unified Diff: tools/presubmit.py

Issue 13849008: Fix so that you can run presubmit.py in Windows. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/presubmit.py
===================================================================
--- tools/presubmit.py (revision 14198)
+++ tools/presubmit.py (working copy)
@@ -228,6 +228,15 @@
def GetPathsToSearch(self):
return ['src', 'preparser', 'include', 'samples', join('test', 'cctest')]
+ def GetCpplintScript(self, prio_path):
+ for path in [prio_path] + os.environ["PATH"].split(os.pathsep):
+ path = path.strip('"')
+ cpplint = os.path.join(path, "cpplint.py")
+ if os.path.isfile(cpplint):
+ return cpplint
+
+ return None
+
def ProcessFiles(self, files, path):
good_files_cache = FileContentsCache('.cpplint-cache')
good_files_cache.Load()
@@ -237,11 +246,15 @@
return True
filt = '-,' + ",".join(['+' + n for n in ENABLED_LINT_RULES])
- command = ['cpplint.py', '--filter', filt]
- local_cpplint = join(path, "tools", "cpplint.py")
- if exists(local_cpplint):
- command = ['python', local_cpplint, '--filter', filt]
+ command = [sys.executable, 'cpplint.py', '--filter', filt]
+ cpplint = self.GetCpplintScript(join(path, "tools"))
+ if cpplint is None:
+ print('Could not find cpplint.py. Make sure '
+ 'depot_tools is installed and in the path.')
+ sys.exit(1)
+ command = [sys.executable, cpplint, '--filter', filt]
+
commands = join([command + [file] for file in files])
count = multiprocessing.cpu_count()
pool = multiprocessing.Pool(count)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698