summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/tools/third_party_files_whitelist.txt335
-rwxr-xr-xandroid_webview/tools/webview_licenses.py221
-rw-r--r--chrome/version.h.in2
-rwxr-xr-xtools/licenses.py10
4 files changed, 562 insertions, 6 deletions
diff --git a/android_webview/tools/third_party_files_whitelist.txt b/android_webview/tools/third_party_files_whitelist.txt
new file mode 100644
index 0000000..e478f2e
--- /dev/null
+++ b/android_webview/tools/third_party_files_whitelist.txt
@@ -0,0 +1,335 @@
+#!/usr/bin/python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file records third-party licensing information for the purposes of the
+# Android WebView build. See webview_licenses.py for details.
+#
+# New third-party code should be added under a directory named 'third_party',
+# so additions to this file should be rare. See
+# http://www.chromium.org/developers/adding-3rd-party-libraries.
+
+# Chromium OS license file.
+LICENSE.chromium_os
+# String 'copyright' used in app properties.
+ash/shell/cocoa/app-Info.plist
+# String 'copyright' used in code.
+base/file_version_info.h
+# String 'copyright' used in code.
+base/file_version_info_mac.h
+# String 'copyright' used in code.
+base/file_version_info_mac.mm
+# String 'copyright' used in code.
+base/file_version_info_unittest.cc
+# String 'copyright' used in code.
+base/file_version_info_win.cc
+# String 'copyright' used in code.
+base/file_version_info_win.h
+# Copyright IBM; MIT license. This third-party code is taken from ICU, the
+# license for which we already pick up from third_party/icu/.
+base/i18n/icu_string_conversions.cc
+# Copyright Ron Rivest, public domain.
+base/md5.cc
+# Copyright The Chromium Authors and The Free Software Foundation; GPL v3
+# license. Not used on Android. TODO(steveblock): Exclude this from the WebView
+# snapshot (https://chromiumcodereview.appspot.com/10695024).
+build/gdb-add-index
+# String 'copyright' used in resources.
+chrome/app/chrome_version.rc.version
+# String 'copyright' used in resources.
+chrome/app/chromium_strings.grd
+# String 'copyright' used in resources.
+chrome/app/generated_resources.grd
+# String 'copyright' used in resources.
+chrome/app/google_chrome_strings.grd
+# String 'copyright' used in resources.
+chrome/app/theme/chromium/BRANDING
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. This third-party code is taken from Mozilla, the license for which
+# we already pick up from third_party/npapi/.
+chrome/browser/download/download_extensions.cc
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/firefox_profile_lock.cc
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/firefox_profile_lock.h
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/firefox_profile_lock_posix.cc
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/firefox_profile_lock_win.cc
+# Copyright Google Inc; MPL, GPL v2 or LGPL v2 license. Not used on Android.
+chrome/browser/importer/mork_reader.cc
+# Copyright Google Inc; MPL, GPL v2 or LGPL v2 license. Not used on Android.
+chrome/browser/importer/mork_reader.h
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/nss_decryptor.cc
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/nss_decryptor_mac.h
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/nss_decryptor_system_nss.cc
+# Copyright Netscape Communications Corporation; MPL, GPL v2 or LGPL v2
+# license. Not used on Android.
+chrome/browser/importer/nss_decryptor_win.h
+# Credits notice for Chrome.
+chrome/browser/resources/about_credits.html
+# String 'copyright' used in code.
+chrome/browser/resources/about_version.html
+# Credits notice for ChromeOS.
+chrome/browser/resources/chromeos/about_os_credits.html
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/image_editor/gallery_scripts.js
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/main_scripts.js
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/media/mediaplayer_scripts.js
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/media/video_player_scripts.js
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/mock_chrome.js
+# String 'copyright' used in code.
+chrome/browser/resources/file_manager/js/photo/photo_import_scripts.js
+# String 'copyright' used in code.
+chrome/browser/resources/help/help.html
+# String 'copyright' used in code.
+chrome/browser/resources/shared/css/about_version.css
+# String 'copyright' used in code.
+chrome/browser/ui/webui/about_ui.cc
+# String 'copyright' used in code.
+chrome/browser/ui/webui/help/help_handler.cc
+# Copyright Google Inc; no license. Example code only.
+chrome_frame/cfinstall/examples/jquery.html
+# Copyright Google Inc; no license. Example code only.
+chrome_frame/cfinstall/examples/local_testing.html
+# Copyright Google Inc; no license. Example code only.
+chrome_frame/cfinstall/examples/simple.html
+# Copyright The Chromium Authors and The Dojo Foundation; BSD license. Not used
+# on Android.
+chrome_frame/CFInstance.js
+# String 'copyright' used in resources.
+chrome_frame/chrome_frame_helper_version.rc
+# String 'copyright' used in resources.
+chrome_frame/chrome_launcher_version.rc
+# String 'copyright' used in resources.
+chrome_frame/chrome_tab_version.rc
+# Copyright Mark Mentovai; MPL, GPL v2 or LGPL v2 license. Not used on Android.
+chrome/installer/mac/pkg-dmg
+# String 'copyright' used in resources.
+chrome/installer/mini_installer/mini_installer_exe_version.rc.version
+# String 'copyright' used in resources.
+chrome/installer/setup/setup_exe_version.rc.version
+# String 'copyright' used in code.
+chrome/tools/convert_dict/aff_reader.h
+# String 'copyright' used in code.
+chrome/tools/mac_helpers/infoplist_strings_util.mm
+# Copyright Google Inc; BSD license. Test code only.
+chrome/tools/test/generate_mime_tests.pl
+# String 'copyright' used in code.
+cloud_print/service/win/cloud_print_service.rc
+# String 'copyright' used in code.
+cloud_print/virtual_driver/win/virtual_driver_common_resources.rc
+# Copyright Alf Watt; BSD license. Not used on Android.
+content/browser/geolocation/osx_wifi.h
+# Copyright The Chromium Authors, Apple Inc and Graham Dennis; BSD license. Not
+# used on Android.
+content/browser/renderer_host/render_widget_host_view_mac.mm
+# Copyright The Chromium Authors and Google Inc; BSD license. Not used on
+# Android.
+content/browser/renderer_host/web_input_event_aurax11.cc
+# Copyright Google Inc, no license. Not used on Android.
+google_update/google_update_idl.idl
+# Uses word 'copyright'.
+LICENSE
+# Copyright Loren Merritt, Anton Mitrofanov and Jason Garrett-Glaser; ISC
+# license. Not used on Android.
+media/base/simd/x86inc.asm
+# String 'copyright' used in resources.
+media/tools/player_wtl/player_wtl.rc
+# Copyright The Chromium Authors and Netscape Communications Corporation; BSD
+# and (MPL, GPL v2 or LGPL v2) licenses. This third-party code is taken from
+# Mozilla, the license for which we already pick up from third_party/npapi/.
+net/cookies/cookie_monster.cc
+# Copyright The Chromium Authors and Netscape Communications Corporation; BSD
+# and (MPL, GPL v2 or LGPL v2) licenses. This third-party code is taken from
+# Mozilla, the license for which we already pick up from third_party/npapi/.
+net/cookies/canonical_cookie.cc
+# Copyright The Chromium Authors and Netscape Communications Corporation; BSD
+# and (MPL, GPL v2 or LGPL v2) licenses. This third-party code is taken from
+# Mozilla, the license for which we already pick up from third_party/npapi/.
+net/cookies/parsed_cookie.cc
+# Copyright The Chromium Authors and Google Inc; BSD and (MPL, GPL v2 or LGPL
+# v2) licenses. This third-party code is taken from Mozilla, the license for
+# which we already pick up from third_party/npapi/.
+net/base/registry_controlled_domains/registry_controlled_domain.cc
+# Copyright The Chromium Authors and Google Inc; BSD and (MPL, GPL v2 or LGPL
+# v2) licenses. This third-party code is taken from Mozilla, the license for
+# which we already pick up from third_party/npapi/.
+net/base/registry_controlled_domains/registry_controlled_domain.h
+# String '(c)' used in code.
+net/base/x509_cert_types_unittest.cc
+# Copyright John LoVerso; no license. Test code only.
+net/data/proxy_resolver_perftest/no-ads.pac
+# String '(c)' used in certificate data.
+net/data/ssl/certificates/certse.pem
+# Copyright The Chromium Authors and IBM Corporation; BSD and (MPL, GPL v2 or
+# LGPL v2) licenses. This third-party code is taken from Mozilla, the license
+# for which we already pick up from third_party/npapi/.
+net/http/des.cc
+# Copyright The Chromium Authors and IBM Corporation; BSD and (MPL, GPL v2 or
+# LGPL v2) licenses. This third-party code is taken from Mozilla, the license
+# for which we already pick up from third_party/npapi/.
+net/http/http_auth_handler_ntlm_portable.cc
+# Copyright The Chromium Authors and Netscape Communications; BSD and (MPL, GPL
+# v2 or LGPL v2) licenses. This third-party code is taken from Mozilla, the
+# license for which we already pick up from third_party/npapi/.
+net/http/http_chunked_decoder.cc
+# Copyright The Chromium Authors and Netscape Communications; BSD and (MPL, GPL
+# v2 or LGPL v2) licenses. This third-party code is taken from Mozilla, the
+# license for which we already pick up from third_party/npapi/.
+net/http/http_chunked_decoder.h
+# Copyright IBM Corporation; MPL, GPL v2 or LGPL v2 license. This third-party
+# code is taken from Mozilla, the license for which we already pick up from
+# third_party/npapi/.
+net/http/md4.cc
+# Copyright IBM Corporation; MPL, GPL v2 or LGPL v2 license. This third-party
+# code is taken from Mozilla, the license for which we already pick up from
+# third_party/npapi/.
+net/http/md4.h
+# Netscape Communications Corporation; MPL, GPL v2 or LGPL v2 license. This
+# third-party code is taken from Mozilla, the license for which we already pick
+# up from third_party/npapi/.
+net/proxy/proxy_resolver_script.h
+# Copyright The Chromium Authors and Netscape Communications Corporation; BSD
+# and (MPL, GPL v2 or LGPL v2) licenses. Not used on Android.
+net/socket/ssl_client_socket_nss.cc
+# String 'copyright' used in resources.
+remoting/chromium_branding
+# String 'copyright' used in resources.
+remoting/google_chrome_branding
+# String 'copyright' used in project file.
+remoting/host/installer/mac/ChromotingHost.packproj
+# String 'copyright' used in project file.
+remoting/host/installer/mac/ChromotingHostService.packproj
+# String 'copyright' used in project file.
+remoting/host/installer/mac/ChromotingHostUninstaller.packproj
+# String 'copyright' used in project file.
+remoting/host/installer/mac/uninstaller/remoting_uninstaller-Info.plist
+# String 'copyright' used in project file.
+remoting/host/me2me_preference_pane-Info.plist
+# String 'copyright' used in project file.
+remoting/host/remoting_me2me_host-Info.plist
+# String 'copyright' used in file.
+remoting/remoting.gyp
+# String 'copyright' used in resources.
+remoting/version.rc.version
+# Copyright The Android Open Source Project; ASL v2 license.
+skia/config/SkUserConfig.h
+# Copyright Google Inc; ASL v2 license.
+skia/ext/SkFontHost_fontconfig_control.h
+# Copyright Google Inc; ASL v2 license.
+skia/ext/SkFontHost_fontconfig.cpp
+# Copyright Google Inc; ASL v2 license.
+skia/ext/SkFontHost_fontconfig_direct.cpp
+# Copyright Google Inc; ASL v2 license.
+skia/ext/SkFontHost_fontconfig_direct.h
+# Copyright Google Inc; ASL v2 license.
+skia/ext/SkFontHost_fontconfig_impl.h
+# String 'copyright' used in code.
+tools/checklicenses/checklicenses.py
+# Sample output includes string 'copyright'.
+tools/emacs/trybot-windows.txt
+# String 'copyright' used in code.
+tools/gen_keyboard_overlay_data/gen_keyboard_overlay_data.py
+# String 'copyright' used in code.
+tools/git/update-copyrights.sh
+# String 'copyright' used in code.
+tools/json_schema_compiler/cpp_util.py
+# String 'copyright' used in code.
+tools/json_schema_compiler/idl_schema.py
+# String 'copyright' used in resources.
+tools/measure_page_load_time/ie_bho/MeasurePageLoadTime.rc
+# String 'copyright' used in code.
+tools/stats_viewer/Properties/AssemblyInfo.cs
+# License for pefile.py.
+tools/symsrc/COPYING-pefile
+# Copyright Ero Carrera; BSD license. Tool only.
+tools/symsrc/pefile.py
+# Copyright The Chromium Authors, Sun Microsystems Inc, the V8 project authors;
+# BSD license. Tool only.
+tools/traceline/traceline/assembler.h
+# Copyright Google Inc; BSD license. Tool only.
+tools/traceline/traceline/sidestep/mini_disassembler.cc
+# Copyright The Chromium Authors, Apple Inc; BSD license. Not used on Android.
+ui/base/clipboard/clipboard_util_win.cc
+# Copyright The Chromium Authors, Apple Inc; BSD license. Not used on Android.
+ui/base/dragdrop/os_exchange_data_provider_win.cc
+# Copyright The Chromium Authors, Apple Inc, Michael Emmel, Holger Hans Peter
+# Freyther, Collabora Ltd, Google Inc; BSD license. Not used on Android.
+ui/base/keycodes/keyboard_code_conversion_gtk.cc
+# Copyright The Chromium Authors, Apple Inc, Michael Emmel, Holger Hans Peter
+# Freyther, Collabora Ltd, Google Inc; BSD license. Not used on Android.
+ui/base/keycodes/keyboard_code_conversion_gtk.h
+# Copyright The Chromium Authors, Michael Emmel, Google Inc; BSD license. This
+# third-party code is taken from WebKit, the license for which we already pick
+# up from webkit/.
+ui/base/keycodes/keyboard_codes_posix.h
+# This third-party code is taken from Mozilla, but is copyright Google and has
+# been re-licensed under the Chromium license.
+ui/gfx/codec/jpeg_codec.cc
+# This third-party code is taken from Mozilla, but is copyright Google and has
+# been re-licensed under the Chromium license.
+ui/gfx/codec/png_codec.cc
+# Copyright The Chromium Authors and Apple Inc; BSD license. This third-party
+# code is taken from WebKit, the license for which we already pick up from
+# webkit/.
+webkit/appcache/manifest_parser.cc
+# Copyright The Chromium Authors and Apple Inc; BSD license. This third-party
+# code is taken from WebKit, the license for which we already pick up from
+# webkit/.
+webkit/appcache/manifest_parser.h
+# Copyright W3C, MIT, INRIA and Keio; no license. Test code only.
+webkit/data/test_shell/frames/iframe1.html
+# Copyright Apple Inc; BSD license. Not used on Android, inspector frontend is
+# not bundled.
+webkit/glue/inspector_strings.grd
+# Copyright The Chromium Authors and Netscape Communications Corporation; BSD
+# and (MPL, GPL v2 or LGPL v2) licenses. This third-party code is taken from
+# Mozilla, the license for which we already pick up from third_party/npapi/.
+webkit/glue/multipart_response_delegate.h
+# License for numerous binary files in this directory: Copyright Netscape
+# Communications Corporation; MPL, GPL v2 or LGPL v2 license. This third-party
+# code is taken from WebKit and Mozilla, the licenses for which we already pick
+# up from webkit/ and third_party/npapi/.
+webkit/glue/resources/README.txt
+# Copyright Tim Copperfield and Christian Dywan; LGPL license. Not used on
+# Android.
+webkit/glue/webcursor_gtk_data.h
+# Copyright Apple Inc and Netscape Communications Corporation; BSD and (MPL,
+# GPL v2 or LGPL v2) licenses. This third-party code is taken from WebKit and
+# Mozilla, the licenses for which we already pick up from webkit/ and
+# third_party/npapi/.
+webkit/glue/webkit_strings.grd
+# Summary of licenses.
+webkit/LICENSE
+# String 'copyright' used in resources.
+webkit/plugins/npapi/test/npapi_test.rc
+# This third-party code is taken from Mozilla, but is copyright Google and has
+# been re-licensed under the Chromium license.
+webkit/support/webkit_support_gfx.cc
+# Copyright Apple, Inc, Graham Dennis and Eric Seidel; BSD license. Tool only
+webkit/tools/test_shell/mac/DumpRenderTreePasteboard.h
+# Copyright Apple, Inc, Graham Dennis and Eric Seidel; BSD license. Tool only
+webkit/tools/test_shell/mac/DumpRenderTreePasteboard.m
+# String 'copyright' used in resources.
+webkit/tools/test_shell/mac/English.lproj/InfoPlist.strings
+# License for missingImage.tiff: Copyright Apple Computer, Inc; BSD license.
+# Tool only
+webkit/tools/test_shell/resources/README.txt
+# String 'copyright' used in resources.
+webkit/tools/test_shell/resources/test_shell.rc
diff --git a/android_webview/tools/webview_licenses.py b/android_webview/tools/webview_licenses.py
new file mode 100755
index 0000000..e15e164
--- /dev/null
+++ b/android_webview/tools/webview_licenses.py
@@ -0,0 +1,221 @@
+#!/usr/bin/python
+# Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Checks third-party licenses for the purposes of the Android WebView build.
+
+The Android tree includes a snapshot of Chromium in order to power the system
+WebView. This tool checks that all code uses open-source licenses compatible
+with Android, and that we meet the requirements of those licenses. It can also
+be used to generate an Android NOTICE file for the third-party code.
+
+It makes use of src/tools/licenses.py and the README.chromium files on which
+it depends. It also makes use of a data file, third_party_files_whitelist.txt,
+which whitelists indicidual files which contain third-party code but which
+aren't in a third-party directory with a README.chromium file.
+"""
+
+import optparse
+import os
+import re
+import subprocess
+import sys
+import textwrap
+
+
+REPOSITORY_ROOT = os.path.abspath(os.path.join(
+ os.path.dirname(__file__), '..', '..'))
+
+sys.path.append(os.path.join(REPOSITORY_ROOT, 'tools'))
+import licenses
+
+
+def _CheckLicenseHeaders(directory_list, whitelisted_files):
+ """Checks that all files which are not in a listed third-party directory,
+ and which do not use the standard Chromium license, are whitelisted.
+ Args:
+ directory_list: The list of directories.
+ whitelisted_files: The whitelist of files.
+ Returns:
+ True if all files with non-standard license headers are whitelisted and the
+ whitelist contains no stale entries, otherwise false.
+ """
+
+ # Matches one of ...
+ # - '[Cc]opyright', but not when followed by
+ # ' 20[0-9][0-9] The Chromium Authors.', with optional (c) and date range
+ # - '([Cc]) (19|20)[0-9][0-9]', but not when preceeded by the word copyright,
+ # as this is handled above
+ regex = '[Cc]opyright(?!( \(c\))? 20[0-9][0-9](-20[0-9][0-9])? ' \
+ 'The Chromium Authors\. All rights reserved\.)' \
+ '|' \
+ '(?<!(pyright |opyright))\([Cc]\) (19|20)[0-9][0-9]'
+
+ args = ['grep',
+ '-rPlI',
+ '--exclude-dir', 'third_party',
+ '--exclude-dir', 'out',
+ '--exclude-dir', '.git',
+ regex,
+ '.']
+ p = subprocess.Popen(args=args, cwd=REPOSITORY_ROOT, stdout=subprocess.PIPE)
+ files = p.communicate()[0].splitlines()
+
+ directory_list = directory_list[:]
+ # Ignore these tools.
+ directory_list.append('android_webview/tools/')
+ # This is a build intermediate directory.
+ directory_list.append('chrome/app/theme/google_chrome/')
+ # This is a test output directory.
+ directory_list.append('data/page_cycler/')
+ # 'Copyright' appears in strings.
+ directory_list.append('chrome/app/resources/')
+
+ # Exclude files under listed directories and some known offenders.
+ offending_files = []
+ for x in files:
+ x = os.path.normpath(x)
+ is_in_listed_directory = False
+ for y in directory_list:
+ if x.startswith(y):
+ is_in_listed_directory = True
+ break
+ if not is_in_listed_directory:
+ offending_files.append(x)
+
+ all_files_valid = True
+ unknown = set(offending_files) - set(whitelisted_files)
+ if unknown:
+ print 'The following files contain a third-party license but are not in ' \
+ 'a listed third-party directory and are not whitelisted. You must ' \
+ 'add the following files to the whitelist.\n%s' % \
+ '\n'.join(sorted(unknown))
+ all_files_valid = False
+
+ stale = set(whitelisted_files) - set(offending_files)
+ if stale:
+ print 'The following files are whitelisted unnecessarily. You must ' \
+ ' remove the following files from the whitelist.\n%s' % \
+ '\n'.join(sorted(stale))
+ all_files_valid = False
+
+ return all_files_valid
+
+
+def _ReadFile(path):
+ """Reads a file from disk.
+ Args:
+ path: The path of the file to read, relative to the root of the repository.
+ Returns:
+ The contents of the file as a string.
+ """
+
+ return open(os.path.join(REPOSITORY_ROOT, path), 'rb').read()
+
+
+def _FindThirdPartyDirs():
+ """Gets the list of third-party directories.
+ Returns:
+ The list of third-party directories.
+ """
+
+ prune_paths = [
+ # Placeholder directory, no third-party code.
+ os.path.join('third_party', 'adobe'),
+ # Apache 2.0 license. See
+ # https://code.google.com/p/chromium/issues/detail?id=140478.
+ os.path.join('third_party', 'bidichecker'),
+ ]
+ return licenses.FindThirdPartyDirs(prune_paths)
+
+
+def _Scan():
+ """Checks that license meta-data is present for all third-party code.
+ Returns:
+ Whether the check succeeded.
+ """
+
+ third_party_dirs = _FindThirdPartyDirs()
+
+ # First, check designated third-party directories using src/tools/licenses.py.
+ all_licenses_valid = True
+ for path in sorted(third_party_dirs):
+ try:
+ licenses.ParseDir(path)
+ except licenses.LicenseError, e:
+ print 'Got LicenseError "%s" while scanning %s' % (e, path)
+ all_licenses_valid = False
+
+ # Second, check for non-standard license text.
+ files_data = _ReadFile(os.path.join('android_webview', 'tools',
+ 'third_party_files_whitelist.txt'))
+ whitelisted_files = []
+ for line in files_data.splitlines():
+ match = re.match(r'([^#\s]+)', line)
+ if match:
+ whitelisted_files.append(match.group(1))
+ return _CheckLicenseHeaders(third_party_dirs, whitelisted_files) \
+ and all_licenses_valid
+
+
+def _GenerateNoticeFile(print_warnings):
+ """Generates the contents of an Android NOTICE file for the third-party code.
+ Args:
+ print_warnings: Whether to print warnings.
+ Returns:
+ The contents of the NOTICE file.
+ """
+
+ third_party_dirs = _FindThirdPartyDirs()
+
+ # Don't forget Chromium's LICENSE file
+ content = [_ReadFile('LICENSE')]
+
+ # We provide attribution for all third-party directories.
+ # TODO(steveblock): Limit this to only code used by the WebView binary.
+ for directory in third_party_dirs:
+ license_file = licenses.ParseDir(directory)['License File']
+ if license_file != licenses.NOT_SHIPPED:
+ content.append(_ReadFile(license_file))
+
+ return '\n'.join(content)
+
+
+def main():
+ class FormatterWithNewLines(optparse.IndentedHelpFormatter):
+ def format_description(self, description):
+ paras = description.split('\n')
+ formatted_paras = [textwrap.fill(para, self.width) for para in paras]
+ return '\n'.join(formatted_paras) + '\n'
+
+ parser = optparse.OptionParser(formatter=FormatterWithNewLines(),
+ usage='%prog [options]')
+ parser.description = (__doc__ +
+ '\nCommands:\n' \
+ ' scan Check licenses.\n' \
+ ' notice Generate Android NOTICE file on stdout')
+ (options, args) = parser.parse_args()
+ if len(args) != 1:
+ parser.print_help()
+ return 1
+
+ if os.getcwd() != REPOSITORY_ROOT:
+ print "This tool can only be run from the repository root."
+ return 1
+
+ if args[0] == 'scan':
+ if _Scan():
+ print 'OK!'
+ return 0
+ else:
+ return 1
+ elif args[0] == 'notice':
+ print _GenerateNoticeFile(print_warnings=False)
+ return 0
+
+ parser.print_help()
+ return 1
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/chrome/version.h.in b/chrome/version.h.in
index c8a23ad..f0a0bcd 100644
--- a/chrome/version.h.in
+++ b/chrome/version.h.in
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/tools/licenses.py b/tools/licenses.py
index d67c082..d4140f8 100755
--- a/tools/licenses.py
+++ b/tools/licenses.py
@@ -310,13 +310,13 @@ def ContainsFiles(path):
return False
-def FindThirdPartyDirs():
+def FindThirdPartyDirs(prune_paths):
"""Find all third_party directories underneath the current directory."""
third_party_dirs = []
for path, dirs, files in os.walk('.'):
path = path[len('./'):] # Pretty up the path.
- if path in PRUNE_PATHS:
+ if path in prune_paths:
dirs[:] = []
continue
@@ -331,7 +331,7 @@ def FindThirdPartyDirs():
# Add all subdirectories that are not marked for skipping.
for dir in dirs:
dirpath = os.path.join(path, dir)
- if dirpath not in PRUNE_PATHS:
+ if dirpath not in prune_paths:
third_party_dirs.append(dirpath)
# Don't recurse into any subdirs from here.
@@ -353,7 +353,7 @@ def FindThirdPartyDirs():
def ScanThirdPartyDirs():
"""Scan a list of directories and report on any problems we find."""
- third_party_dirs = FindThirdPartyDirs()
+ third_party_dirs = FindThirdPartyDirs(PRUNE_PATHS)
errors = []
for path in sorted(third_party_dirs):
@@ -381,7 +381,7 @@ def GenerateCredits():
template = template.replace('{{%s}}' % key, val)
return template
- third_party_dirs = FindThirdPartyDirs()
+ third_party_dirs = FindThirdPartyDirs(PRUNE_PATHS)
entry_template = open('chrome/browser/resources/about_credits_entry.tmpl',
'rb').read()