OLD | NEW |
---|---|
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import os.path # for initializing constants | 5 import os.path # for initializing constants |
6 | 6 |
7 # Directories that we run presubmit checks on. | 7 # Directories that we run presubmit checks on. |
8 PRESUBMIT_PATH = os.path.normpath('chrome/common/extensions/PRESUBMIT.py') | 8 PRESUBMIT_PATH = os.path.normpath('chrome/common/extensions/PRESUBMIT.py') |
9 API_DIR = os.path.normpath('chrome/common/extensions/api') | 9 API_DIR = os.path.normpath('chrome/common/extensions/api') |
10 DOC_DIR = os.path.normpath('chrome/common/extensions/docs') | 10 DOC_DIR = os.path.normpath('chrome/common/extensions/docs') |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 IsStaticDoc(path, input_api) or | 140 IsStaticDoc(path, input_api) or |
141 IsSampleFile(path, input_api) | 141 IsSampleFile(path, input_api) |
142 for path in input_api.LocalPaths()) | 142 for path in input_api.LocalPaths()) |
143 | 143 |
144 def StaticDocBuilt(static_file, input_api): | 144 def StaticDocBuilt(static_file, input_api): |
145 """Return True if the generated doc that corresponds to the |static_file| | 145 """Return True if the generated doc that corresponds to the |static_file| |
146 is also in this change. Both files must also contain matching changes. | 146 is also in this change. Both files must also contain matching changes. |
147 """ | 147 """ |
148 for subdir in [APPS_DIR, EXTENSIONS_DIR]: | 148 for subdir in [APPS_DIR, EXTENSIONS_DIR]: |
149 generated_file = _FindFileInAlternateDir(static_file, subdir, input_api) | 149 generated_file = _FindFileInAlternateDir(static_file, subdir, input_api) |
150 if not _ChangesMatch(generated_file, static_file): | 150 if _ChangesMatch(generated_file, static_file): |
151 return False | 151 return True |
152 return True | 152 return False |
Joao da Silva
2012/08/08 09:11:50
I'll be wearing a brown bag over my head today ._.
| |
153 | 153 |
154 def _FindFileInAlternateDir(affected_file, alt_dir, input_api): | 154 def _FindFileInAlternateDir(affected_file, alt_dir, input_api): |
155 """Return an AffectFile for the file in |alt_dir| that corresponds to | 155 """Return an AffectFile for the file in |alt_dir| that corresponds to |
156 |affected_file|. | 156 |affected_file|. |
157 | 157 |
158 If the file does not exist in the is change, return None. | 158 If the file does not exist in the is change, return None. |
159 """ | 159 """ |
160 alt_path = _AlternateFilePath(affected_file.LocalPath(), alt_dir, input_api) | 160 alt_path = _AlternateFilePath(affected_file.LocalPath(), alt_dir, input_api) |
161 for f in input_api.AffectedFiles(): | 161 for f in input_api.AffectedFiles(): |
162 if f.LocalPath() == alt_path: | 162 if f.LocalPath() == alt_path: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 def SampleZipped(sample_file, input_api): | 220 def SampleZipped(sample_file, input_api): |
221 """Return True if the zipfile that should contain |sample_file| is in | 221 """Return True if the zipfile that should contain |sample_file| is in |
222 this change. | 222 this change. |
223 """ | 223 """ |
224 sample_path = sample_file.LocalPath() | 224 sample_path = sample_file.LocalPath() |
225 for af in input_api.AffectedFiles(): | 225 for af in input_api.AffectedFiles(): |
226 root, ext = input_api.os_path.splitext(af.LocalPath()) | 226 root, ext = input_api.os_path.splitext(af.LocalPath()) |
227 if ext == '.zip' and sample_path.startswith(root): | 227 if ext == '.zip' and sample_path.startswith(root): |
228 return True | 228 return True |
229 return False | 229 return False |
OLD | NEW |