| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 return [output_api.PresubmitPromptWarning(REBUILD_WARNING + '\n' + | 80 return [output_api.PresubmitPromptWarning(REBUILD_WARNING + '\n' + |
| 81 ''.join(warnings) + | 81 ''.join(warnings) + |
| 82 REBUILD_INSTRUCTIONS)] | 82 REBUILD_INSTRUCTIONS)] |
| 83 return [] | 83 return [] |
| 84 | 84 |
| 85 def IsSkippedFile(path, input_api): | 85 def IsSkippedFile(path, input_api): |
| 86 return input_api.os_path.basename(path) in EXCEPTIONS | 86 return input_api.os_path.basename(path) in EXCEPTIONS |
| 87 | 87 |
| 88 def IsApiFile(path, input_api): | 88 def IsApiFile(path, input_api): |
| 89 return (input_api.os_path.dirname(path) == API_DIR and | 89 return (input_api.os_path.dirname(path) == API_DIR and |
| 90 path.endswith('.json')) | 90 (path.endswith('.json') or path.endswith('.idl'))) |
| 91 | 91 |
| 92 def IsBuildFile(path, input_api): | 92 def IsBuildFile(path, input_api): |
| 93 return input_api.os_path.dirname(path) == BUILD_DIR | 93 return input_api.os_path.dirname(path) == BUILD_DIR |
| 94 | 94 |
| 95 def IsTemplateFile(path, input_api): | 95 def IsTemplateFile(path, input_api): |
| 96 return input_api.os_path.dirname(path) == TEMPLATE_DIR | 96 return input_api.os_path.dirname(path) == TEMPLATE_DIR |
| 97 | 97 |
| 98 def IsJsFile(path, input_api): | 98 def IsJsFile(path, input_api): |
| 99 return (input_api.os_path.dirname(path) == JS_DIR and | 99 return (input_api.os_path.dirname(path) == JS_DIR and |
| 100 path.endswith('.js')) | 100 path.endswith('.js')) |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 def SampleZipped(sample_file, input_api): | 214 def SampleZipped(sample_file, input_api): |
| 215 """Return True if the zipfile that should contain |sample_file| is in | 215 """Return True if the zipfile that should contain |sample_file| is in |
| 216 this change. | 216 this change. |
| 217 """ | 217 """ |
| 218 sample_path = sample_file.LocalPath() | 218 sample_path = sample_file.LocalPath() |
| 219 for af in input_api.AffectedFiles(): | 219 for af in input_api.AffectedFiles(): |
| 220 root, ext = input_api.os_path.splitext(af.LocalPath()) | 220 root, ext = input_api.os_path.splitext(af.LocalPath()) |
| 221 if ext == '.zip' and sample_path.startswith(root): | 221 if ext == '.zip' and sample_path.startswith(root): |
| 222 return True | 222 return True |
| 223 return False | 223 return False |
| OLD | NEW |