Chromium Code Reviews| Index: build/android/gyp/util/build_utils.py |
| diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py |
| index fe69c956f0f9f49db1ceb4e085c84668e1c7a5fc..a3422ebeecb3138f11fa1b9ab803bb912e5b25f2 100644 |
| --- a/build/android/gyp/util/build_utils.py |
| +++ b/build/android/gyp/util/build_utils.py |
| @@ -11,6 +11,7 @@ import pipes |
| import re |
| import shlex |
| import shutil |
| +import stat |
| import subprocess |
| import sys |
| import tempfile |
| @@ -198,6 +199,17 @@ def CheckZipPath(name): |
| raise Exception('Absolute zip path: %s' % name) |
| +def IsSymlink(zip_file, name): |
| + zi = zip_file.getinfo(name) |
| + |
| + # The two high-order bytes of ZipInfo.external_attr represent |
| + # UNIX permissions and file type bits. |
| + if stat.S_ISLNK(zi.external_attr >> 16L): |
|
jbudorick
2016/01/30 17:33:37
nit: just
return stat.S_ISLNK(zi.external_attr
Mostyn Bramley-Moore
2016/01/30 17:41:25
Done.
|
| + return True |
| + |
| + return False |
| + |
| + |
| def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None, |
| predicate=None): |
| if path is None: |
| @@ -221,7 +233,12 @@ def ExtractAll(zip_path, path=None, no_clobber=True, pattern=None, |
| raise Exception( |
| 'Path already exists from zip: %s %s %s' |
| % (zip_path, name, output_path)) |
| - z.extract(name, path) |
| + if IsSymlink(z, name): |
| + dest = os.path.join(path, name) |
| + MakeDirectory(os.path.dirname(dest)) |
| + os.symlink(z.read(name), dest) |
| + else: |
| + z.extract(name, path) |
| def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None, |