Update V8 to version 4.5.86.
[chromium-blink-merge.git] / tools / telemetry / PRESUBMIT.py
blobbd6aa5af66ba5a5b31ae37912bbbd74e39ef0434
1 # Copyright 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 import os
5 import sys
8 def _CommonChecks(input_api, output_api):
9 results = []
11 # TODO(nduca): This should call update_docs.IsUpdateDocsNeeded().
12 # Disabled due to crbug.com/255326.
13 if False:
14 update_docs_path = os.path.join(
15 input_api.PresubmitLocalPath(), 'update_docs')
16 assert os.path.exists(update_docs_path)
17 results.append(output_api.PresubmitError(
18 'Docs are stale. Please run:\n' +
19 '$ %s' % os.path.abspath(update_docs_path)))
21 pylint_checks = input_api.canned_checks.GetPylint(
22 input_api, output_api, black_list=[], pylintrc='pylintrc')
24 results.extend(input_api.RunTests(pylint_checks))
25 return results
27 def GetPathsToPrepend(input_api):
28 return [input_api.PresubmitLocalPath(),
29 os.path.join(input_api.PresubmitLocalPath(), os.path.pardir,
30 os.path.pardir, 'third_party', 'typ')]
32 def RunWithPrependedPath(prepended_path, fn, *args):
33 old_path = sys.path
35 try:
36 sys.path = prepended_path + old_path
37 return fn(*args)
38 finally:
39 sys.path = old_path
41 def CheckChangeOnUpload(input_api, output_api):
42 def go():
43 results = []
44 results.extend(_CommonChecks(input_api, output_api))
45 return results
46 return RunWithPrependedPath(GetPathsToPrepend(input_api), go)
48 def CheckChangeOnCommit(input_api, output_api):
49 def go():
50 results = []
51 results.extend(_CommonChecks(input_api, output_api))
52 return results
53 return RunWithPrependedPath(GetPathsToPrepend(input_api), go)