Skip to content

Commit

Permalink
Preserve file permissions in zap_download.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ksperling-apple committed Dec 6, 2023
1 parent 26b0bbf commit 1bc6a68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/tools/zap/zap_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ def _SetupReleaseZap(install_directory: str, zap_version: str):
z = zipfile.ZipFile(io.BytesIO(r.content))

logging.info("Data downloaded, extracting ...")
z.extractall(install_directory)
# extractall() does not preserve permissions (https://github.com/python/cpython/issues/59999)
for entry in z.filelist:
path = z.extract(entry, install_directory)
os.chmod(path, (entry.external_attr >> 16) & 0o777)
logging.info("Done extracting.")


Expand Down

0 comments on commit 1bc6a68

Please sign in to comment.