def _FindThirdPartyDirs(): """Gets the list of third-party directories. Returns: The list of third-party directories. """ # Please don't add here paths that have problems with license files, # as they will end up included in Android WebView snapshot. # Instead, add them into known_issues.py. 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'), # Isn't checked out on clients os.path.join('third_party', 'gles2_conform'), # The llvm-build doesn't exist for non-clang builder os.path.join('third_party', 'llvm-build'), # Binaries doesn't apply to android os.path.join('third_party', 'widevine'), # third_party directories in this tree aren't actually third party, but # provide a way to shadow experimental buildfiles into those directories. os.path.join('tools', 'gn', 'secondary'), # Not shipped, Chromium code os.path.join('tools', 'swarming_client'), ] third_party_dirs = licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT) return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT)
def find_chromium_licenses(chromium_root): """Look for license files in a Chromium checkout and return a set with all files that are actually shipped and used in the final Chromium binary.""" try: import licenses except ImportError: raise ImportError('Failed to import licenses.py. Make sure %s ' 'contains tools/licenses.py.' % chromium_root) # Make sure the main Chromium LICENSE file is always present. license_files = set([os.path.join(chromium_root, 'LICENSE')]) for d in licenses.FindThirdPartyDirs(licenses.PRUNE_PATHS, chromium_root): if d in SKIPPED_DIRECTORIES: continue try: metadata = licenses.ParseDir(d, chromium_root) except licenses.LicenseError as e: print('Exception in directory %s: %s' % (d, e)) if input('Ignore (y)? ') == 'y': continue raise # We are not interested in licenses for projects that are not marked as # used in the final product (ie. they might be optional development # aids, or only used in a build). if metadata['License File'] != licenses.NOT_SHIPPED: license_files.add(metadata['License File']) return license_files
def GenerateLicense(output_filename=None): """Generate list of licenses in html form. Dumps the result to output file. Args: output_filename: Filename to write the license.html to. Writes to stdout if None. Returns: 0 on success. """ chromium_root = os.path.join(toplevel_dir, 'external', 'chromium') third_party_dirs = set( licenses.FindThirdPartyDirs(licenses.PRUNE_PATHS, chromium_root)) prune_paths = CreateSteelPruneList(third_party_dirs) third_party_dirs -= prune_paths entries = [] for path in sorted(third_party_dirs): try: metadata = licenses.ParseDir(path, chromium_root) except licenses.LicenseError: print >> sys.stderr, ('WARNING: licensing info for ' + path + ' is incomplete, skipping.') continue if metadata['License File'] != 'NOT_SHIPPED': env = { 'name': metadata['Name'], 'url': metadata['URL'], 'license': open(metadata['License File'], 'rb').read(), } entries.append(env) if output_filename: output_file = open(output_filename, 'wb') else: output_file = sys.stdout for e in entries: output_file.write('<h4>\n') output_file.write(e['name'] + '\n') output_file.write('</h4>\n') output_file.write('<pre>\n') output_file.write(e['license'] + '\n') output_file.write('</pre>\n') return 0
def ScanDirectories(): """Verify all directories (that we use) have valid license information.""" # The functions we call in licenses.py assume we are at the root. os.chdir(toplevel_dir) # Add all the directories we don't use to PRUNE_PATHS. third_party_dirs = set( licenses.FindThirdPartyDirs(licenses.PRUNE_PATHS, os.getcwd())) prune_paths = CreateSteelPruneList(third_party_dirs) licenses.PRUNE_PATHS = set(licenses.PRUNE_PATHS) | prune_paths # Now verify the presence of a license file in all our third party dirs. if licenses.ScanThirdPartyDirs(): print 'scan successful.' return 1
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'), # Isn't checked out on clients os.path.join('third_party', 'gles2_conform'), # The llvm-build doesn't exist for non-clang builder os.path.join('third_party', 'llvm-build'), ] return licenses.FindThirdPartyDirs(prune_paths)
def _FindThirdPartyDirs(): """Gets the list of third-party directories. Returns: The list of third-party directories. """ # Please don't add here paths that have problems with license files, # as they will end up included in Android WebView snapshot. # Instead, add them into known_issues.py. prune_paths = [ # Temporary until we figure out how not to check out quickoffice on the # Android license check bot. Tracked in crbug.com/350472. os.path.join('chrome', 'browser', 'resources', 'chromeos', 'quickoffice'), # 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'), # Isn't checked out on clients os.path.join('third_party', 'gles2_conform'), # The llvm-build doesn't exist for non-clang builder os.path.join('third_party', 'llvm-build'), # Binaries doesn't apply to android os.path.join('third_party', 'widevine'), # third_party directories in this tree aren't actually third party, but # provide a way to shadow experimental buildfiles into those directories. os.path.join('build', 'secondary'), # Not shipped, Chromium code os.path.join('tools', 'swarming_client'), # Not shipped, only relates to Chrome for Android, but not to WebView os.path.join('clank'), # Bots only, is not a part of the build os.path.join('isolate_deps_dir'), ] third_party_dirs = licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT) return licenses.FilterDirsWithFiles(third_party_dirs, REPOSITORY_ROOT)
def _FindThirdPartyDirs(): """Gets the list of third-party directories. Returns: The list of third-party directories. """ # Please don't add here paths that have problems with license files, # as they will end up included in Android WebView snapshot. # Instead, add them into known_issues.py. 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'), # Isn't checked out on clients os.path.join('third_party', 'gles2_conform'), # The llvm-build doesn't exist for non-clang builder os.path.join('third_party', 'llvm-build'), # Binaries doesn't apply to android os.path.join('third_party', 'widevine'), ] return licenses.FindThirdPartyDirs(prune_paths, REPOSITORY_ROOT)