Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: android_webview/tools/webview_licenses.py

Issue 10872061: [Android] Update Android WebView license checking tool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | build/android/buildbot_functions.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Checks third-party licenses for the purposes of the Android WebView build. 6 """Checks third-party licenses for the purposes of the Android WebView build.
7 7
8 The Android tree includes a snapshot of Chromium in order to power the system 8 The Android tree includes a snapshot of Chromium in order to power the system
9 WebView. This tool checks that all code uses open-source licenses compatible 9 WebView. This tool checks that all code uses open-source licenses compatible
10 with Android, and that we meet the requirements of those licenses. It can also 10 with Android, and that we meet the requirements of those licenses. It can also
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 regex = '[Cc]opyright(?!( \(c\))? 20[0-9][0-9](-20[0-9][0-9])? ' \ 84 regex = '[Cc]opyright(?!( \(c\))? 20[0-9][0-9](-20[0-9][0-9])? ' \
85 'The Chromium Authors\. All rights reserved\.)' \ 85 'The Chromium Authors\. All rights reserved\.)' \
86 '|' \ 86 '|' \
87 '(?<!(pyright |opyright))\([Cc]\) (19|20)[0-9][0-9]' 87 '(?<!(pyright |opyright))\([Cc]\) (19|20)[0-9][0-9]'
88 88
89 args = ['grep', 89 args = ['grep',
90 '-rPlI', 90 '-rPlI',
91 '--exclude-dir', 'third_party', 91 '--exclude-dir', 'third_party',
92 '--exclude-dir', 'out', 92 '--exclude-dir', 'out',
93 '--exclude-dir', '.git', 93 '--exclude-dir', '.git',
94 '--exclude-dir', '.svn',
94 regex, 95 regex,
95 '.'] 96 '.']
96 p = subprocess.Popen(args=args, cwd=REPOSITORY_ROOT, stdout=subprocess.PIPE) 97 p = subprocess.Popen(args=args, cwd=REPOSITORY_ROOT, stdout=subprocess.PIPE)
97 files = p.communicate()[0].splitlines() 98 files = p.communicate()[0].splitlines()
98 99
99 directory_list = directory_list[:] 100 directory_list = directory_list[:]
100 # Ignore these tools. 101 # Ignore these tools.
101 directory_list.append('android_webview/tools/') 102 directory_list.append('android_webview/tools/')
102 # This is a build intermediate directory. 103 # This is a build intermediate directory.
103 directory_list.append('chrome/app/theme/google_chrome/') 104 directory_list.append('chrome/app/theme/google_chrome/')
105 # This is tests directory, doesn't exist in the snapshot
106 directory_list.append('content/test/data/')
107 # This is a test output directory.
108 directory_list.append('data/dom_perf/')
104 # This is a test output directory. 109 # This is a test output directory.
105 directory_list.append('data/page_cycler/') 110 directory_list.append('data/page_cycler/')
106 # 'Copyright' appears in strings. 111 # 'Copyright' appears in strings.
107 directory_list.append('chrome/app/resources/') 112 directory_list.append('chrome/app/resources/')
108 # This is a Chrome on Linux reference build, doesn't exist in the snapshot 113 # This is a Chrome on Linux reference build, doesn't exist in the snapshot
109 directory_list.append('chrome/tools/test/reference_build/chrome_linux/') 114 directory_list.append('chrome/tools/test/reference_build/chrome_linux/')
115 # Remoting internal tools, doesn't exist in the snapshot
116 directory_list.append('remoting/appengine/')
117 # Histogram tools, doesn't exist in the snapshot
118 directory_list.append('tools/histograms/')
110 119
111 # Exclude files under listed directories and some known offenders. 120 # Exclude files under listed directories and some known offenders.
112 offending_files = [] 121 offending_files = []
113 for x in files: 122 for x in files:
114 x = os.path.normpath(x) 123 x = os.path.normpath(x)
115 is_in_listed_directory = False 124 is_in_listed_directory = False
116 for y in directory_list: 125 for y in directory_list:
117 if x.startswith(y): 126 if x.startswith(y):
118 is_in_listed_directory = True 127 is_in_listed_directory = True
119 break 128 break
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 Returns: 164 Returns:
156 The list of third-party directories. 165 The list of third-party directories.
157 """ 166 """
158 167
159 prune_paths = [ 168 prune_paths = [
160 # Placeholder directory, no third-party code. 169 # Placeholder directory, no third-party code.
161 os.path.join('third_party', 'adobe'), 170 os.path.join('third_party', 'adobe'),
162 # Apache 2.0 license. See 171 # Apache 2.0 license. See
163 # https://code.google.com/p/chromium/issues/detail?id=140478. 172 # https://code.google.com/p/chromium/issues/detail?id=140478.
164 os.path.join('third_party', 'bidichecker'), 173 os.path.join('third_party', 'bidichecker'),
174 # Isn't checked out on clients
175 os.path.join('third_party', 'gles2_conform'),
165 ] 176 ]
166 return licenses.FindThirdPartyDirs(prune_paths) 177 return licenses.FindThirdPartyDirs(prune_paths)
167 178
168 179
169 def _Scan(): 180 def _Scan():
170 """Checks that license meta-data is present for all third-party code. 181 """Checks that license meta-data is present for all third-party code.
171 Returns: 182 Returns:
172 Whether the check succeeded. 183 Whether the check succeeded.
173 """ 184 """
174 185
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return 1 259 return 1
249 elif args[0] == 'notice': 260 elif args[0] == 'notice':
250 print GenerateNoticeFile() 261 print GenerateNoticeFile()
251 return 0 262 return 0
252 263
253 parser.print_help() 264 parser.print_help()
254 return 1 265 return 1
255 266
256 if __name__ == '__main__': 267 if __name__ == '__main__':
257 sys.exit(main()) 268 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | build/android/buildbot_functions.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698