OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """Utility for checking and processing licensing information in third_party | 6 """Utility for checking and processing licensing information in third_party |
7 directories. | 7 directories. |
8 | 8 |
9 Usage: licenses.py <command> | 9 Usage: licenses.py <command> |
10 | 10 |
11 Commands: | 11 Commands: |
12 scan scan third_party directories, verifying that we have licensing info | 12 scan scan third_party directories, verifying that we have licensing info |
13 credits generate about:credits on stdout | 13 credits generate about:credits on stdout |
14 | 14 |
15 (You can also import this as a module.) | 15 (You can also import this as a module.) |
16 """ | 16 """ |
17 | 17 |
18 import cgi | 18 import cgi |
19 import os | 19 import os |
20 import sys | 20 import sys |
21 | 21 |
22 # Paths from the root of the tree to directories to skip. | 22 # Paths from the root of the tree to directories to skip. |
23 PRUNE_PATHS = set([ | 23 PRUNE_PATHS = set([ |
24 # Same module occurs in both the top-level third_party and others. | 24 # Same module occurs in both the top-level third_party and others. |
25 "base/third_party/icu", | 25 os.path.join('base','third_party','icu'), |
26 | 26 |
27 # Assume for now that breakpad has their licensing in order. | 27 # Assume for now that breakpad has their licensing in order. |
28 "breakpad", | 28 os.path.join('breakpad'), |
29 | 29 |
30 # This is just a tiny vsprops file, presumably written by the googleurl | 30 # This is just a tiny vsprops file, presumably written by the googleurl |
31 # authors. Not third-party code. | 31 # authors. Not third-party code. |
32 "googleurl/third_party/icu", | 32 os.path.join('googleurl','third_party','icu'), |
33 | 33 |
34 # Assume for now that native client has their licensing in order. | 34 # Assume for now that native client has their licensing in order. |
35 "native_client", | 35 os.path.join('native_client'), |
36 | 36 |
37 # Same module occurs in chrome/ and in net/, so skip one of them. | 37 # Same module occurs in chrome/ and in net/, so skip one of them. |
38 "net/third_party/mozilla_security_manager", | 38 os.path.join('net','third_party','mozilla_security_manager'), |
39 | 39 |
40 # Same module occurs in base/ and in net/, so skip one of them. | 40 # Same module occurs in base/, net/, and src/ so skip all but one of them. |
41 "net/third_party/nss", | 41 os.path.join('third_party','nss'), |
42 os.path.join('net','third_party','nss'), | |
42 | 43 |
43 # We don't bundle o3d samples into our resulting binaries. | 44 # We don't bundle o3d samples into our resulting binaries. |
44 "o3d/samples", | 45 os.path.join('o3d','samples'), |
45 | 46 |
46 # Not in the public Chromium tree. | 47 # Not in the public Chromium tree. |
47 "third_party/adobe", | 48 os.path.join('third_party','adobe'), |
48 | 49 |
49 # Written as part of Chromium. | 50 # Written as part of Chromium. |
50 "third_party/fuzzymatch", | 51 os.path.join('third_party','fuzzymatch'), |
51 | 52 |
52 # Same license as Chromium. | 53 # Same license as Chromium. |
53 "third_party/lss", | 54 os.path.join('third_party','lss'), |
54 | 55 |
55 # Only binaries, used during development. | 56 # Only binaries, used during development. |
56 "third_party/valgrind", | 57 os.path.join('third_party','valgrind'), |
57 | 58 |
58 # Two directories that are the same as those in base/third_party. | 59 # Two directories that are the same as those in base/third_party. |
59 "v8/src/third_party/dtoa", | 60 os.path.join('v8','src','third_party','dtoa'), |
60 "v8/src/third_party/valgrind", | 61 os.path.join('v8','src','third_party','valgrind'), |
62 | |
63 # Used for development and test, not in the shipping product. | |
64 os.path.join('third_party','cygwin'), | |
65 os.path.join('third_party','lighttpd'), | |
66 # ---- Check with NACL on this one... we're just pulling bin, not LICENSE | |
67 # ---- in DEPS. | |
evanm
2011/01/16 18:26:27
Don't forget to follow up on this (I don't quite u
| |
68 os.path.join('third_party','mingw-w64'), | |
69 os.path.join('third_party','pefile'), | |
70 os.path.join('third_party','python_26'), | |
71 | |
72 # Redistribution does not require attribution in documentation. | |
73 os.path.join('third_party','directxsdk'), | |
74 os.path.join('third_party','platformsdk_win2008_6_1'), | |
75 os.path.join('third_party','platformsdk_win7'), | |
76 | |
77 # Harfbuzz-ng is not currently shipping in any product: | |
78 os.path.join('third_party','harfbuzz-ng'), | |
61 ]) | 79 ]) |
62 | 80 |
63 # Directories we don't scan through. | 81 # Directories we don't scan through. |
64 PRUNE_DIRS = ('.svn', '.git', # VCS metadata | 82 PRUNE_DIRS = ('.svn', '.git', # VCS metadata |
65 'out', 'Debug', 'Release', # build files | 83 'out', 'Debug', 'Release', # build files |
66 'layout_tests') # lots of subdirs | 84 'layout_tests') # lots of subdirs |
67 | 85 |
68 ADDITIONAL_PATHS = ( | 86 ADDITIONAL_PATHS = ( |
69 # The directory with the word list for Chinese and Japanese segmentation | 87 # The directory with the word list for Chinese and Japanese segmentation |
70 # with different license terms than ICU. | 88 # with different license terms than ICU. |
71 "third_party/icu/source/data/brkitr", | 89 os.path.join('third_party','icu','source','data','brkitr'), |
72 ) | 90 ) |
73 | 91 |
74 | 92 |
75 # Directories where we check out directly from upstream, and therefore | 93 # Directories where we check out directly from upstream, and therefore |
76 # can't provide a README.chromium. Please prefer a README.chromium | 94 # can't provide a README.chromium. Please prefer a README.chromium |
77 # wherever possible. | 95 # wherever possible. |
78 SPECIAL_CASES = { | 96 SPECIAL_CASES = { |
79 os.path.join('third_party', 'angle'): { | 97 os.path.join('third_party', 'angle'): { |
80 "Name": "Almost Native Graphics Layer Engine", | 98 "Name": "Almost Native Graphics Layer Engine", |
81 "URL": "http://code.google.com/p/angleproject/", | 99 "URL": "http://code.google.com/p/angleproject/", |
(...skipping 13 matching lines...) Expand all Loading... | |
95 os.path.join('third_party', 'pywebsocket'): { | 113 os.path.join('third_party', 'pywebsocket'): { |
96 "Name": "pywebsocket", | 114 "Name": "pywebsocket", |
97 "URL": "http://code.google.com/p/pywebsocket/", | 115 "URL": "http://code.google.com/p/pywebsocket/", |
98 }, | 116 }, |
99 os.path.join('third_party', 'WebKit'): { | 117 os.path.join('third_party', 'WebKit'): { |
100 "Name": "WebKit", | 118 "Name": "WebKit", |
101 "URL": "http://webkit.org/", | 119 "URL": "http://webkit.org/", |
102 # Absolute path here is resolved as relative to the source root. | 120 # Absolute path here is resolved as relative to the source root. |
103 "License File": "/webkit/LICENSE", | 121 "License File": "/webkit/LICENSE", |
104 }, | 122 }, |
123 os.path.join('third_party', 'GTM'): { | |
124 "Name": "Google Toolbox for Mac", | |
125 "URL": "http://code.google.com/p/google-toolbox-for-mac/", | |
126 "License File": "COPYING", | |
127 }, | |
128 # pdfsqueeze is Apache Licensed, reuse the same file from GTM: | |
evanm
2011/01/16 18:26:27
I'm not sure in this case, but some licenses requi
| |
129 os.path.join('third_party', 'pdfsqueeze'): { | |
130 "Name": "pdfsqueeze", | |
131 "URL": "http://code.google.com/p/pdfsqueeze/", | |
132 "License File": os.path.join('..','GTM','COPYING'), | |
133 }, | |
105 } | 134 } |
106 | 135 |
107 class LicenseError(Exception): | 136 class LicenseError(Exception): |
108 """We raise this exception when a directory's licensing info isn't | 137 """We raise this exception when a directory's licensing info isn't |
109 fully filled out.""" | 138 fully filled out.""" |
110 pass | 139 pass |
111 | 140 |
112 | 141 |
113 def ParseDir(path): | 142 def ParseDir(path): |
114 """Examine a third_party/foo component and extract its metadata.""" | 143 """Examine a third_party/foo component and extract its metadata.""" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 | 291 |
263 if command == 'scan': | 292 if command == 'scan': |
264 if not ScanThirdPartyDirs(): | 293 if not ScanThirdPartyDirs(): |
265 sys.exit(1) | 294 sys.exit(1) |
266 elif command == 'credits': | 295 elif command == 'credits': |
267 if not GenerateCredits(): | 296 if not GenerateCredits(): |
268 sys.exit(1) | 297 sys.exit(1) |
269 else: | 298 else: |
270 print __doc__ | 299 print __doc__ |
271 sys.exit(1) | 300 sys.exit(1) |
OLD | NEW |