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 """Presubmit script for changes affecting extensions. | 5 """Presubmit script for changes affecting extensions. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 import fnmatch | 10 import fnmatch |
(...skipping 30 matching lines...) Expand all Loading... | |
41 name = os.path.splitext(name)[0] | 41 name = os.path.splitext(name)[0] |
42 s1 = re.sub('([a-z])([A-Z])', r'\1_\2', name) | 42 s1 = re.sub('([a-z])([A-Z])', r'\1_\2', name) |
43 s2 = re.sub('([A-Z]+)([A-Z][a-z])', r'\1_\2', s1) | 43 s2 = re.sub('([A-Z]+)([A-Z][a-z])', r'\1_\2', s1) |
44 return s2.replace('.', '_').lower() | 44 return s2.replace('.', '_').lower() |
45 | 45 |
46 def _FindMatchingTemplates(template_name, template_path_list): | 46 def _FindMatchingTemplates(template_name, template_path_list): |
47 matches = [] | 47 matches = [] |
48 unix_name = _UnixName(template_name) | 48 unix_name = _UnixName(template_name) |
49 for template in template_path_list: | 49 for template in template_path_list: |
50 if unix_name == _UnixName(template.split(os.sep)[-1]): | 50 if unix_name == _UnixName(template.split(os.sep)[-1]): |
51 matches.append(template) | 51 matches.append(os.path.splitext(template)[0]) |
not at google - send to devlin
2014/02/13 22:12:32
Comment needed
| |
52 return matches | 52 return matches |
53 | 53 |
54 def _SanitizeAPIName(name, api_path): | 54 def _SanitizeAPIName(name, api_path): |
55 if not api_path.endswith(os.sep): | 55 if not api_path.endswith(os.sep): |
56 api_path += os.sep | 56 api_path += os.sep |
57 filename = os.path.splitext(name)[0][len(api_path):].replace(os.sep, '_') | 57 filename = os.path.splitext(name)[0][len(api_path):].replace(os.sep, '_') |
58 if 'experimental' in filename: | 58 if 'experimental' in filename: |
59 filename = 'experimental_' + filename.replace('experimental_', '') | 59 filename = 'experimental_' + filename.replace('experimental_', '') |
60 return filename | 60 return filename |
61 | 61 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 # See http://crbug.com/297178. | 150 # See http://crbug.com/297178. |
151 #_CheckLinks(input_api, output_api, results) | 151 #_CheckLinks(input_api, output_api, results) |
152 | 152 |
153 return results | 153 return results |
154 | 154 |
155 def CheckChangeOnUpload(input_api, output_api): | 155 def CheckChangeOnUpload(input_api, output_api): |
156 return _CheckChange(input_api, output_api) | 156 return _CheckChange(input_api, output_api) |
157 | 157 |
158 def CheckChangeOnCommit(input_api, output_api): | 158 def CheckChangeOnCommit(input_api, output_api): |
159 return _CheckChange(input_api, output_api) | 159 return _CheckChange(input_api, output_api) |
OLD | NEW |