blob: 4370630a141c2cfa82144e8f39a919752759da19 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/python
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os.path
# When files in these directories are changed, we display a warning.
DEPENDENT_DIRS = set([
os.path.normpath("chrome/common/extensions/api"),
os.path.normpath("chrome/common/extensions/docs")
])
# Except for these directories.
BLACKLIST_DIRS = set([
os.path.normpath("chrome/common/extensions/docs/server")
])
REBUILD_WARNING = """
This change modifies file(s) which the extension docs depend on. You must
rebuild the extension docs.
Build by running the build.py script in chrome/common/extensions/docs/build/.
Be sure to include any modified resulting static files
(/common/extension/docs/*.html) in your final changelist.
"""
def CheckChange(input_api, output_api):
for f in input_api.AffectedFiles():
dir = os.path.normpath(input_api.os_path.dirname(f.LocalPath()))
while len(dir):
if dir in BLACKLIST_DIRS:
return []
if dir in DEPENDENT_DIRS:
return [output_api.PresubmitPromptWarning(REBUILD_WARNING)]
dir = os.path.dirname(dir)
return []
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)
|