support adding symlinks to zip files
Add symlinks as symlinks to zip files, not their target in place of the symlink. Review URL: https://codereview.chromium.org/1875663002 Cr-Original-Commit-Position: refs/heads/master@{#386199} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: a7da5525463f06dd692dfc4740b4aeb6ffc6f681
This commit is contained in:
Родитель
7becd5c6e5
Коммит
e7957ef5cd
|
@ -267,6 +267,12 @@ def AddToZipHermetic(zip_file, zip_path, src_path=None, data=None,
|
|||
zipinfo = zipfile.ZipInfo(filename=zip_path, date_time=_HERMETIC_TIMESTAMP)
|
||||
zipinfo.external_attr = _HERMETIC_FILE_ATTR
|
||||
|
||||
if src_path and os.path.islink(src_path):
|
||||
zipinfo.filename = zip_path
|
||||
zipinfo.external_attr |= stat.S_IFLNK << 16L # mark as a symlink
|
||||
zip_file.writestr(zipinfo, os.readlink(src_path))
|
||||
return
|
||||
|
||||
if src_path:
|
||||
with file(src_path) as f:
|
||||
data = f.read()
|
||||
|
|
Загрузка…
Ссылка в новой задаче