summaryrefslogtreecommitdiffstats
path: root/chromium/build/android/gyp/util
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 11:40:17 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-24 12:42:11 +0000
commit5d87695f37678f96492b258bbab36486c59866b4 (patch)
treebe9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/build/android/gyp/util
parent6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff)
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/build/android/gyp/util')
-rw-r--r--chromium/build/android/gyp/util/build_utils.py23
-rwxr-xr-xchromium/build/android/gyp/util/build_utils_test.py6
-rwxr-xr-xchromium/build/android/gyp/util/diff_utils.py24
-rw-r--r--chromium/build/android/gyp/util/md5_check.py10
-rwxr-xr-xchromium/build/android/gyp/util/md5_check_test.py8
-rw-r--r--chromium/build/android/gyp/util/proguard_util.py12
-rwxr-xr-xchromium/build/android/gyp/util/resource_utils_test.py8
7 files changed, 65 insertions, 26 deletions
diff --git a/chromium/build/android/gyp/util/build_utils.py b/chromium/build/android/gyp/util/build_utils.py
index ad26224673e..e4d7cc61289 100644
--- a/chromium/build/android/gyp/util/build_utils.py
+++ b/chromium/build/android/gyp/util/build_utils.py
@@ -22,8 +22,7 @@ import zipfile
# Any new non-system import must be added to:
# //build/config/android/internal_rules.gni
-# Some clients do not add //build/android/gyp to PYTHONPATH.
-import md5_check # pylint: disable=relative-import
+from util import md5_check
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir, os.pardir, os.pardir))
@@ -36,7 +35,7 @@ DIR_SOURCE_ROOT = os.environ.get('CHECKOUT_SOURCE_ROOT',
os.pardir, os.pardir, os.pardir, os.pardir)))
HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0)
-_HERMETIC_FILE_ATTR = (0644 << 16L)
+_HERMETIC_FILE_ATTR = (0o644 << 16)
@contextlib.contextmanager
@@ -263,7 +262,7 @@ def _IsSymlink(zip_file, name):
# The two high-order bytes of ZipInfo.external_attr represent
# UNIX permissions and file type bits.
- return stat.S_ISLNK(zi.external_attr >> 16L)
+ return stat.S_ISLNK(zi.external_attr >> 16)
def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None,
@@ -326,19 +325,19 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
if src_path and os.path.islink(src_path):
zipinfo.filename = zip_path
- zipinfo.external_attr |= stat.S_IFLNK << 16L # mark as a symlink
+ zipinfo.external_attr |= stat.S_IFLNK << 16 # mark as a symlink
zip_file.writestr(zipinfo, os.readlink(src_path))
return
# zipfile.write() does
- # external_attr = (os.stat(src_path)[0] & 0xFFFF) << 16L
+ # external_attr = (os.stat(src_path)[0] & 0xFFFF) << 16
# but we want to use _HERMETIC_FILE_ATTR, so manually set
# the few attr bits we care about.
if src_path:
st = os.stat(src_path)
for mode in (stat.S_IXUSR, stat.S_IXGRP, stat.S_IXOTH):
if st.st_mode & mode:
- zipinfo.external_attr |= mode << 16L
+ zipinfo.external_attr |= mode << 16
if src_path:
with open(src_path, 'rb') as f:
@@ -482,7 +481,7 @@ def GetSortedTransitiveDependencies(top, deps_func):
deps_map[node] = deps
discover(top)
- return deps_map.keys()
+ return list(deps_map)
def _ComputePythonDependencies():
@@ -573,9 +572,6 @@ def ExpandFileArgs(args):
if not match:
continue
- if match.end() != len(arg):
- raise Exception('Unexpected characters after FileArg: ' + arg)
-
lookup_path = match.group(1).split(':')
file_path = lookup_path[0]
if not file_path in file_jsons:
@@ -589,9 +585,10 @@ def ExpandFileArgs(args):
# This should match ParseGnList. The output is either a GN-formatted list
# or a literal (with no quotes).
if isinstance(expansion, list):
- new_args[i] = arg[:match.start()] + gn_helpers.ToGNString(expansion)
+ new_args[i] = (arg[:match.start()] + gn_helpers.ToGNString(expansion) +
+ arg[match.end():])
else:
- new_args[i] = arg[:match.start()] + str(expansion)
+ new_args[i] = arg[:match.start()] + str(expansion) + arg[match.end():]
return new_args
diff --git a/chromium/build/android/gyp/util/build_utils_test.py b/chromium/build/android/gyp/util/build_utils_test.py
index bcc892f39b3..d462f0c6769 100755
--- a/chromium/build/android/gyp/util/build_utils_test.py
+++ b/chromium/build/android/gyp/util/build_utils_test.py
@@ -4,9 +4,13 @@
# found in the LICENSE file.
import collections
+import os
+import sys
import unittest
-import build_utils # pylint: disable=W0403
+sys.path.insert(
+ 0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
+from util import build_utils
_DEPS = collections.OrderedDict()
_DEPS['a'] = []
diff --git a/chromium/build/android/gyp/util/diff_utils.py b/chromium/build/android/gyp/util/diff_utils.py
index 85acb681ca5..b20dc27df2e 100755
--- a/chromium/build/android/gyp/util/diff_utils.py
+++ b/chromium/build/android/gyp/util/diff_utils.py
@@ -4,7 +4,10 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
+
import difflib
+from util import build_utils
def DiffFileContents(expected_path, actual_path):
@@ -16,11 +19,26 @@ def DiffFileContents(expected_path, actual_path):
if expected_lines == actual_lines:
return None
+ expected_path = os.path.relpath(expected_path, build_utils.DIR_SOURCE_ROOT)
+ actual_path = os.path.relpath(actual_path, build_utils.DIR_SOURCE_ROOT)
+
diff = difflib.unified_diff(
expected_lines,
actual_lines,
- fromfile=expected_path,
- tofile=actual_path,
+ fromfile=os.path.join('before', expected_path),
+ tofile=os.path.join('after', expected_path),
n=0)
- return '\n'.join(diff)
+ # Space added before "patch" so that giant command is not put in bash history.
+ return """\
+Files Compared:
+ * {}
+ * {}
+
+To update the file, run:
+########### START ###########
+ patch -p1 <<'END_DIFF'
+{}
+END_DIFF
+############ END ############
+""".format(expected_path, actual_path, ''.join(diff).rstrip())
diff --git a/chromium/build/android/gyp/util/md5_check.py b/chromium/build/android/gyp/util/md5_check.py
index bac22a01985..9a15ee6e75a 100644
--- a/chromium/build/android/gyp/util/md5_check.py
+++ b/chromium/build/android/gyp/util/md5_check.py
@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+from __future__ import print_function
+
import difflib
import hashlib
import itertools
@@ -78,10 +80,10 @@ def CallAndRecordIfStale(
return
if PRINT_EXPLANATIONS:
- print '=' * 80
- print 'Target is stale: %s' % record_path
- print changes.DescribeDifference()
- print '=' * 80
+ print('=' * 80)
+ print('Target is stale: %s' % record_path)
+ print(changes.DescribeDifference())
+ print('=' * 80)
args = (changes,) if pass_changes else ()
function(*args)
diff --git a/chromium/build/android/gyp/util/md5_check_test.py b/chromium/build/android/gyp/util/md5_check_test.py
index 75ddf3e91ff..41e9d3c248c 100755
--- a/chromium/build/android/gyp/util/md5_check_test.py
+++ b/chromium/build/android/gyp/util/md5_check_test.py
@@ -4,11 +4,15 @@
# found in the LICENSE file.
import fnmatch
+import os
+import sys
import tempfile
import unittest
import zipfile
-import md5_check # pylint: disable=W0403
+sys.path.insert(
+ 0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
+from util import md5_check
def _WriteZipFile(path, entries):
@@ -26,7 +30,7 @@ class TestMd5Check(unittest.TestCase):
input_strings = ['string1', 'string2']
input_file1 = tempfile.NamedTemporaryFile(suffix='.txt')
input_file2 = tempfile.NamedTemporaryFile(suffix='.zip')
- file1_contents = 'input file 1'
+ file1_contents = b'input file 1'
input_file1.write(file1_contents)
input_file1.flush()
# Test out empty zip file to start.
diff --git a/chromium/build/android/gyp/util/proguard_util.py b/chromium/build/android/gyp/util/proguard_util.py
index b9fecabbfd6..c0fba206dc3 100644
--- a/chromium/build/android/gyp/util/proguard_util.py
+++ b/chromium/build/android/gyp/util/proguard_util.py
@@ -53,6 +53,7 @@ class ProguardCmdBuilder(object):
self._outjar = None
self._mapping_output = None
self._verbose = False
+ self._min_api = None
self._disabled_optimizations = []
def outjar(self, path):
@@ -93,6 +94,10 @@ class ProguardCmdBuilder(object):
def verbose(self, verbose):
self._verbose = verbose
+ def min_api(self, min_api):
+ assert self._min_api is None
+ self._min_api = min_api
+
def disable_optimizations(self, optimizations):
self._disabled_optimizations += optimizations
@@ -111,6 +116,13 @@ class ProguardCmdBuilder(object):
if self._libraries:
cmd += ['-libraryjars', ':'.join(self._libraries)]
+ if self._min_api:
+ cmd += [
+ '-assumevalues class android.os.Build$VERSION {' +
+ ' public static final int SDK_INT return ' + self._min_api +
+ '..9999; }'
+ ]
+
for optimization in self._disabled_optimizations:
cmd += [ '-optimizations', '!' + optimization ]
diff --git a/chromium/build/android/gyp/util/resource_utils_test.py b/chromium/build/android/gyp/util/resource_utils_test.py
index 8aa29d40074..dc1094aca08 100755
--- a/chromium/build/android/gyp/util/resource_utils_test.py
+++ b/chromium/build/android/gyp/util/resource_utils_test.py
@@ -6,15 +6,17 @@
import collections
import os
-import unittest
import sys
+import unittest
-import build_utils # pylint: disable=relative-import
+sys.path.insert(
+ 0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
+from util import build_utils
# Required because the following import needs build/android/gyp in the
# Python path to import util.build_utils.
_BUILD_ANDROID_GYP_ROOT = os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..'))
+ os.path.join(os.path.dirname(__file__), os.pardir))
sys.path.insert(1, _BUILD_ANDROID_GYP_ROOT)
import resource_utils # pylint: disable=relative-import