cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / common / extensions / docs / server2 / PRESUBMIT.py
blobc64d416307317d540c79af1c8d7510c1cf908370
1 # Copyright (c) 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.
5 """Presubmit script for changes affecting extensions docs server
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8 for more details about the presubmit API built into depot_tools.
9 """
11 # Run build_server so that files needed by tests are copied to the local
12 # third_party directory.
13 import os
14 import sys
16 WHITELIST = [ r'.+_test.py$' ]
17 # The integration tests are selectively run from the PRESUBMIT in
18 # chrome/common/extensions. Github filesystem support is currently
19 # disabled.
20 BLACKLIST = [ r'integration_test.py$', r'.*github.*_test.py$' ]
22 def _BuildServer(input_api):
23 try:
24 sys.path.insert(0, input_api.PresubmitLocalPath())
25 import build_server
26 build_server.main()
27 finally:
28 sys.path.pop(0)
30 def _WarnIfAppYamlHasntChanged(input_api, output_api):
31 app_yaml_path = os.path.join(input_api.PresubmitLocalPath(), 'app.yaml')
32 if app_yaml_path in input_api.AbsoluteLocalPaths():
33 return []
34 return [output_api.PresubmitPromptOrNotify('''
35 **************************************************
36 CHANGE DETECTED IN SERVER2 WITHOUT APP.YAML UPDATE
37 **************************************************
38 Maybe this is ok? Follow this simple guide:
40 Q: Does this change any data that might get stored?
41 * Did you add/remove/update a field to a data source?
42 * Did you add/remove/update some data that gets sent to templates?
43 * Is this change to support a new feature in the templates?
44 * Does this change include changes to templates?
45 Yes? Bump the middle version and zero out the end version, i.e. 2-5-2 -> 2-6-0.
46 THIS WILL CAUSE THE CURRENTLY RUNNING SERVER TO STOP UPDATING.
47 PUSH THE NEW VERSION ASAP.
48 No? Continue.
49 Q: Is this a non-trivial change to the server?
50 Yes? Bump the end version.
51 Unlike above, the server will *not* stop updating.
52 No? Are you sure? How much do you bet? This can't be rolled back...
54 Q: Is this a spelling correction? New test? Better comments?
55 Yes? Ok fine. Ignore this warning.
56 No? I guess this presubmit check doesn't work.
57 ''')]
59 def _RunPresubmit(input_api, output_api):
60 _BuildServer(input_api)
61 # For now, print any lint errors. When these have been eliminated,
62 # move these into the warning list below.
63 # See crbug.com/434363 and crbug.com/461130.
64 lint_errors = input_api.canned_checks.RunPylint(input_api, output_api)
65 if lint_errors:
66 print(lint_errors)
68 return (
69 _WarnIfAppYamlHasntChanged(input_api, output_api) +
70 input_api.canned_checks.RunUnitTestsInDirectory(
71 input_api, output_api, '.', whitelist=WHITELIST, blacklist=BLACKLIST)
74 def CheckChangeOnUpload(input_api, output_api):
75 return _RunPresubmit(input_api, output_api)
77 def CheckChangeOnCommit(input_api, output_api):
78 return _RunPresubmit(input_api, output_api)