OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 ANDROID_WHITELISTED_LICENSES = [ | 5 ANDROID_WHITELISTED_LICENSES = [ |
6 'A(pple )?PSL 2(\.0)?', | 6 'A(pple )?PSL 2(\.0)?', |
7 'Apache( Version)? 2(\.0)?', | 7 'Apache( Version)? 2(\.0)?', |
8 '(New )?([23]-Clause )?BSD( [23]-Clause)?( with advertising clause)?', | 8 '(New )?([23]-Clause )?BSD( [23]-Clause)?( with advertising clause)?', |
9 'L?GPL ?v?2(\.[01])?( or later)?', | 9 'L?GPL ?v?2(\.[01])?( or later)?', |
10 'MIT(/X11)?(-like)?', | 10 'MIT(/X11)?(-like)?', |
(...skipping 15 matching lines...) Expand all Loading... |
26 has_compatible_license = False | 26 has_compatible_license = False |
27 for token in tokens: | 27 for token in tokens: |
28 if input_api.re.match(regex, token, input_api.re.IGNORECASE): | 28 if input_api.re.match(regex, token, input_api.re.IGNORECASE): |
29 has_compatible_license = True | 29 has_compatible_license = True |
30 break | 30 break |
31 return has_compatible_license | 31 return has_compatible_license |
32 | 32 |
33 def _CheckThirdPartyReadmesUpdated(input_api, output_api): | 33 def _CheckThirdPartyReadmesUpdated(input_api, output_api): |
34 """ | 34 """ |
35 Checks to make sure that README.chromium files are properly updated | 35 Checks to make sure that README.chromium files are properly updated |
36 when dependancies in third_party are modified. | 36 when dependencies in third_party are modified. |
37 """ | 37 """ |
38 readmes = [] | 38 readmes = [] |
39 files = [] | 39 files = [] |
40 errors = [] | 40 errors = [] |
41 for f in input_api.AffectedFiles(): | 41 for f in input_api.AffectedFiles(): |
42 local_path = f.LocalPath() | 42 local_path = f.LocalPath() |
43 if input_api.os_path.dirname(local_path) == 'third_party': | 43 if input_api.os_path.dirname(local_path) == 'third_party': |
44 continue | 44 continue |
45 if (local_path.startswith('third_party' + input_api.os_path.sep) and | 45 if (local_path.startswith('third_party' + input_api.os_path.sep) and |
46 not local_path.startswith('third_party' + input_api.os_path.sep + | 46 not local_path.startswith('third_party' + input_api.os_path.sep + |
47 'WebKit' + input_api.os_path.sep)): | 47 'WebKit' + input_api.os_path.sep) and |
| 48 not local_path.startswith('third_party' + input_api.os_path.sep + |
| 49 'boringssl' + input_api.os_path.sep)): |
48 files.append(f) | 50 files.append(f) |
49 if local_path.endswith("README.chromium"): | 51 if local_path.endswith("README.chromium"): |
50 readmes.append(f) | 52 readmes.append(f) |
51 if files and not readmes: | 53 if files and not readmes: |
52 errors.append(output_api.PresubmitPromptWarning( | 54 errors.append(output_api.PresubmitPromptWarning( |
53 'When updating or adding third party code the appropriate\n' | 55 'When updating or adding third party code the appropriate\n' |
54 '\'README.chromium\' file should also be updated with the correct\n' | 56 '\'README.chromium\' file should also be updated with the correct\n' |
55 'version and package information.', files)) | 57 'version and package information.', files)) |
56 if not readmes: | 58 if not readmes: |
57 return errors | 59 return errors |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if 'D' not in f.Action(): | 128 if 'D' not in f.Action(): |
127 errors.append(output_api.PresubmitError( | 129 errors.append(output_api.PresubmitError( |
128 'Third party README should only be removed when the whole\n' | 130 'Third party README should only be removed when the whole\n' |
129 'directory is being removed.\n', [f, affected_file])) | 131 'directory is being removed.\n', [f, affected_file])) |
130 | 132 |
131 | 133 |
132 def CheckChangeOnUpload(input_api, output_api): | 134 def CheckChangeOnUpload(input_api, output_api): |
133 results = [] | 135 results = [] |
134 results.extend(_CheckThirdPartyReadmesUpdated(input_api, output_api)) | 136 results.extend(_CheckThirdPartyReadmesUpdated(input_api, output_api)) |
135 return results | 137 return results |
OLD | NEW |