diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-17 13:57:45 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-07-19 13:44:40 +0000 |
commit | 6ec7b8da05d21a3878bd21c691b41e675d74bb1c (patch) | |
tree | b87f250bc19413750b9bb9cdbf2da20ef5014820 /chromium/tools/licenses.py | |
parent | ec02ee4181c49b61fce1c8fb99292dbb8139cc90 (diff) | |
download | qtwebengine-chromium-6ec7b8da05d21a3878bd21c691b41e675d74bb1c.tar.gz |
BASELINE: Update Chromium to 60.0.3112.70
Change-Id: I9911c2280a014d4632f254857876a395d4baed2d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/tools/licenses.py')
-rwxr-xr-x | chromium/tools/licenses.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/chromium/tools/licenses.py b/chromium/tools/licenses.py index 97600d430cb..bf0b53bc9c3 100755 --- a/chromium/tools/licenses.py +++ b/chromium/tools/licenses.py @@ -19,6 +19,7 @@ import argparse import cgi import os import shutil +import re import subprocess import sys import tempfile @@ -315,6 +316,7 @@ KNOWN_NON_IOS_LIBRARIES = set([ os.path.join('third_party', 'usb_ids'), os.path.join('third_party', 'v8-i18n'), os.path.join('third_party', 'wtl'), + os.path.join('third_party', 'yara'), os.path.join('third_party', 'yasm'), os.path.join('v8', 'strongtalk'), ]) @@ -480,6 +482,22 @@ def _GnBinary(): return os.path.join(_REPOSITORY_ROOT, 'buildtools', subdir, exe) +def GetThirdPartyDepsFromGNDepsOutput(gn_deps): + """Returns third_party/foo directories given the output of "gn desc deps". + + Note that it always returns the direct sub-directory of third_party + where README.chromium and LICENSE files are, so that it can be passed to + ParseDir(). e.g.: + .../third_party/cld_3/src/src/BUILD.gn -> .../third_party/cld_3 + """ + third_party_deps = set() + for build_dep in gn_deps.split(): + m = re.search(r'^(.+/third_party/[^/]+)/(.+/)?BUILD\.gn$', build_dep) + if m: + third_party_deps.add(m.group(1)) + return third_party_deps + + def FindThirdPartyDeps(gn_out_dir, gn_target): if not gn_out_dir: raise RuntimeError("--gn-out-dir is required if --gn-target is used.") @@ -500,12 +518,7 @@ def FindThirdPartyDeps(gn_out_dir, gn_target): if tmp_dir and os.path.exists(tmp_dir): shutil.rmtree(tmp_dir) - third_party_deps = set() - for build_dep in gn_deps.split(): - if ("third_party" in build_dep and - os.path.basename(build_dep) == "BUILD.gn"): - third_party_deps.add(os.path.dirname(build_dep)) - return third_party_deps + return GetThirdPartyDepsFromGNDepsOutput(gn_deps) def ScanThirdPartyDirs(root=None): @@ -590,8 +603,12 @@ def GenerateCredits( 'license_file': metadata['License File'], } entries.append(entry) + # Sort by size in order to improve gzip compression ratio (puts similar + # licenses near each other). The licenses are re-sorted by the JavaScript + # when loaded. + entries.sort(key=lambda entry: (len(entry['content']), + entry['name'], entry['content'])) - entries.sort(key=lambda entry: (entry['name'], entry['content'])) entries_contents = '\n'.join([entry['content'] for entry in entries]) file_template = open(file_template_file).read() template_contents = "<!-- Generated by licenses.py; do not edit. -->" |