Commit ed3c5ff2 authored by mnaganov's avatar mnaganov Committed by Commit bot

[Android WebView] Remove code for generating list of incompatible dirs

This code is not used anymore.

BUG=486158

Review URL: https://codereview.chromium.org/1147773002

Cr-Commit-Position: refs/heads/master@{#330527}
parent 1c43746d
...@@ -56,7 +56,7 @@ KNOWN_INCOMPATIBLE = { ...@@ -56,7 +56,7 @@ KNOWN_INCOMPATIBLE = {
# Code we don't want to build/include by accident from the main chromium # Code we don't want to build/include by accident from the main chromium
# src/ directory. # src/ directory.
'third_party/libjpeg/*.[ch]', 'third_party/libjpeg/',
], ],
'third_party/icu': [ 'third_party/icu': [
# Incompatible code from ICU's repository. # Incompatible code from ICU's repository.
......
...@@ -16,7 +16,6 @@ which whitelists indicidual files which contain third-party code but which ...@@ -16,7 +16,6 @@ which whitelists indicidual files which contain third-party code but which
aren't in a third-party directory with a README.chromium file. aren't in a third-party directory with a README.chromium file.
""" """
import glob
import imp import imp
import json import json
import multiprocessing import multiprocessing
...@@ -57,58 +56,6 @@ class InputApiChange(object): ...@@ -57,58 +56,6 @@ class InputApiChange(object):
def __init__(self): def __init__(self):
self.RepositoryRoot = lambda: REPOSITORY_ROOT self.RepositoryRoot = lambda: REPOSITORY_ROOT
def GetIncompatibleDirectories():
"""Gets a list of third-party directories which use licenses incompatible
with Android. This is used by the snapshot tool.
Returns:
A list of directories.
"""
result = []
for directory in _FindThirdPartyDirs():
if directory in known_issues.KNOWN_ISSUES:
result.append(directory)
continue
try:
metadata = licenses.ParseDir(directory, REPOSITORY_ROOT,
require_license_file=False,
optional_keys=['License Android Compatible'])
except licenses.LicenseError as e:
print 'Got LicenseError while scanning ' + directory
raise
if metadata.get('License Android Compatible', 'no').upper() == 'YES':
continue
license = re.split(' [Ll]icenses?$', metadata['License'])[0]
if not third_party.LicenseIsCompatibleWithAndroid(InputApi(), license):
result.append(directory)
return result
def GetUnknownIncompatibleDirectories():
"""Gets a list of third-party directories which use licenses incompatible
with Android which are not present in the known_issues.py file.
This is used by the AOSP bot.
Returns:
A list of directories.
"""
incompatible_directories = frozenset(GetIncompatibleDirectories())
known_incompatible = []
input_api = InputApi()
for path, exclude_list in known_issues.KNOWN_INCOMPATIBLE.iteritems():
path = copyright_scanner.ForwardSlashesToOsPathSeps(input_api, path)
for exclude in exclude_list:
exclude = copyright_scanner.ForwardSlashesToOsPathSeps(input_api, exclude)
if glob.has_magic(exclude):
exclude_dirname = os.path.dirname(exclude)
if glob.has_magic(exclude_dirname):
print ('Exclude path %s contains an unexpected glob expression,' \
' skipping.' % exclude)
exclude = exclude_dirname
known_incompatible.append(os.path.normpath(os.path.join(path, exclude)))
known_incompatible = frozenset(known_incompatible)
return incompatible_directories.difference(known_incompatible)
class ScanResult(object): class ScanResult(object):
Ok, Warnings, Errors = range(3) Ok, Warnings, Errors = range(3)
...@@ -184,17 +131,6 @@ def _ReadFile(full_path, mode='rU'): ...@@ -184,17 +131,6 @@ def _ReadFile(full_path, mode='rU'):
return f.read() return f.read()
def _ReadLocalFile(path, mode='rb'):
"""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 _ReadFile(os.path.join(REPOSITORY_ROOT, path), mode)
def _FindThirdPartyDirs(): def _FindThirdPartyDirs():
"""Gets the list of third-party directories. """Gets the list of third-party directories.
Returns: Returns:
...@@ -328,13 +264,6 @@ def GenerateNoticeFile(generate_licenses_file_list_only=False): ...@@ -328,13 +264,6 @@ def GenerateNoticeFile(generate_licenses_file_list_only=False):
return template.render({ 'entries': entries }).encode('utf8') return template.render({ 'entries': entries }).encode('utf8')
def _ProcessIncompatibleResult(incompatible_directories):
if incompatible_directories:
print ("Incompatibly licensed directories found:\n" +
"\n".join(sorted(incompatible_directories)))
return ScanResult.Errors
return ScanResult.Ok
def main(): def main():
class FormatterWithNewLines(optparse.IndentedHelpFormatter): class FormatterWithNewLines(optparse.IndentedHelpFormatter):
def format_description(self, description): def format_description(self, description):
...@@ -352,11 +281,6 @@ def main(): ...@@ -352,11 +281,6 @@ def main():
'Android NOTICE file.\n' 'Android NOTICE file.\n'
' notice [file] Generate Android NOTICE file on ' ' notice [file] Generate Android NOTICE file on '
'stdout or into |file|.\n' 'stdout or into |file|.\n'
' incompatible_directories Scan for incompatibly'
' licensed directories.\n'
' all_incompatible_directories Scan for incompatibly'
' licensed directories (even those in'
' known_issues.py).\n'
' display_copyrights Display autorship on the files' ' display_copyrights Display autorship on the files'
' using names provided via stdin.\n') ' using names provided via stdin.\n')
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
...@@ -385,10 +309,6 @@ def main(): ...@@ -385,10 +309,6 @@ def main():
with open(args[1], 'w') as output_file: with open(args[1], 'w') as output_file:
output_file.write(notice_file_contents) output_file.write(notice_file_contents)
return ScanResult.Ok return ScanResult.Ok
elif args[0] == 'incompatible_directories':
return _ProcessIncompatibleResult(GetUnknownIncompatibleDirectories())
elif args[0] == 'all_incompatible_directories':
return _ProcessIncompatibleResult(GetIncompatibleDirectories())
elif args[0] == 'display_copyrights': elif args[0] == 'display_copyrights':
files = sys.stdin.read().splitlines() files = sys.stdin.read().splitlines()
for f, c in \ for f, c in \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment