| 
23 | 23 | #     //build/config/android/internal_rules.gni  | 
24 | 24 | 
 
  | 
25 | 25 | # Some clients do not add //build/android/gyp to PYTHONPATH.  | 
26 |  | -import md5_check  # pylint: disable=relative-import  | 
27 |  | - | 
28 |  | -# pylib conflicts with mojo/public/tools/bindings/pylib. Prioritize  | 
29 |  | -# build/android/pylib.  | 
30 |  | -# PYTHONPATH wouldn't help in this case, because soong put source files under  | 
31 |  | -# temp directory for each build, so the abspath is unknown until the  | 
32 |  | -# execution.  | 
33 |  | -#sys.path.append(os.path.join(os.path.dirname(__file__),  | 
34 |  | -#                             os.pardir, os.pardir, os.pardir))  | 
35 |  | -sys.path.insert(0, os.path.join(os.path.dirname(__file__),  | 
36 |  | -                                os.pardir, os.pardir))  | 
37 |  | - | 
38 |  | -import gn_helpers  | 
 | 26 | +import build.android.gyp.util.md5_check as md5_check # pylint: disable=relative-import  | 
 | 27 | +import build.gn_helpers as gn_helpers  | 
39 | 28 | 
 
  | 
40 | 29 | # Definition copied from pylib/constants/__init__.py to avoid adding  | 
41 | 30 | # a dependency on pylib.  | 
 | 
44 | 33 |                                  os.pardir, os.pardir, os.pardir, os.pardir)))  | 
45 | 34 | 
 
  | 
46 | 35 | HERMETIC_TIMESTAMP = (2001, 1, 1, 0, 0, 0)  | 
47 |  | -_HERMETIC_FILE_ATTR = (0644 << 16L)  | 
 | 36 | +_HERMETIC_FILE_ATTR = (0o644 << 16)  | 
48 | 37 | 
 
  | 
49 | 38 | 
 
  | 
50 | 39 | @contextlib.contextmanager  | 
@@ -246,7 +235,7 @@ def _IsSymlink(zip_file, name):  | 
246 | 235 | 
 
  | 
247 | 236 |   # The two high-order bytes of ZipInfo.external_attr represent  | 
248 | 237 |   # UNIX permissions and file type bits.  | 
249 |  | -  return stat.S_ISLNK(zi.external_attr >> 16L)  | 
 | 238 | +  return stat.S_ISLNK(zi.external_attr >> 16)  | 
250 | 239 | 
 
  | 
251 | 240 | 
 
  | 
252 | 241 | def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None,  | 
@@ -309,12 +298,12 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,  | 
309 | 298 | 
 
  | 
310 | 299 |   if src_path and os.path.islink(src_path):  | 
311 | 300 |     zipinfo.filename = zip_path  | 
312 |  | -    zipinfo.external_attr |= stat.S_IFLNK << 16L # mark as a symlink  | 
 | 301 | +    zipinfo.external_attr |= stat.S_IFLNK << 16 # mark as a symlink  | 
313 | 302 |     zip_file.writestr(zipinfo, os.readlink(src_path))  | 
314 | 303 |     return  | 
315 | 304 | 
 
  | 
316 | 305 |   if src_path:  | 
317 |  | -    with file(src_path) as f:  | 
 | 306 | +    with open(src_path) as f:  | 
318 | 307 |       data = f.read()  | 
319 | 308 | 
 
  | 
320 | 309 |   # zipfile will deflate even when it makes the file bigger. To avoid  | 
@@ -342,7 +331,7 @@ def DoZip(inputs, output, base_dir=None, compress_fn=None):  | 
342 | 331 |   """  | 
343 | 332 |   input_tuples = []  | 
344 | 333 |   for tup in inputs:  | 
345 |  | -    if isinstance(tup, basestring):  | 
 | 334 | +    if isinstance(tup, str):  | 
346 | 335 |       tup = (os.path.relpath(tup, base_dir), tup)  | 
347 | 336 |     input_tuples.append(tup)  | 
348 | 337 | 
 
  | 
@@ -382,7 +371,7 @@ def MergeZips(output, input_zips, path_transform=None):  | 
382 | 371 |   path_transform = path_transform or (lambda p: p)  | 
383 | 372 |   added_names = set()  | 
384 | 373 | 
 
  | 
385 |  | -  output_is_already_open = not isinstance(output, basestring)  | 
 | 374 | +  output_is_already_open = not isinstance(output, str)  | 
386 | 375 |   if output_is_already_open:  | 
387 | 376 |     assert isinstance(output, zipfile.ZipFile)  | 
388 | 377 |     out_zip = output  | 
@@ -445,7 +434,7 @@ def _ComputePythonDependencies():  | 
445 | 434 |   src/. The paths will be relative to the current directory.  | 
446 | 435 |   """  | 
447 | 436 |   _ForceLazyModulesToLoad()  | 
448 |  | -  module_paths = (m.__file__ for m in sys.modules.itervalues()  | 
 | 437 | +  module_paths = (m.__file__ for m in sys.modules.values()  | 
449 | 438 |                   if m is not None and hasattr(m, '__file__'))  | 
450 | 439 |   abs_module_paths = map(os.path.abspath, module_paths)  | 
451 | 440 | 
 
  | 
 | 
0 commit comments