Skip to content

Commit

Permalink
Fix zip path in packed API levels generation
Browse files Browse the repository at this point in the history
Summary:
As title.

Fixes facebook#783.

Reviewed By: thezhangwei

Differential Revision: D45530098

fbshipit-source-id: 2701f042c52c280baba3cccd6db89f04467aea4b
  • Loading branch information
agampe authored and facebook-github-bot committed May 5, 2023
1 parent 2793a84 commit 200d95d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions gen_packed_apilevels.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io
import logging
import os
import shutil
import zipfile
from collections import namedtuple

Expand Down Expand Up @@ -57,7 +58,9 @@ def compress_zip(inputs):
for input in inputs:
logging.info("Adding %s", input)
with open(input, "rb") as f:
zf.writestr(os.path.basename(input), f)
# Files are multi-MB, try to do it smartly.
with zf.open(os.path.basename(input), mode="w") as f2:
shutil.copyfileobj(f, f2)
buf.seek(0)
return buf

Expand Down Expand Up @@ -144,7 +147,7 @@ def _all():
def _load(name):
global _ZIP
return _ZIP.read(names)
return _ZIP.read(name)
def _all():
Expand Down

0 comments on commit 200d95d

Please sign in to comment.