Fix creation of PyInstaller zip files

pull/357/head
nyanpasu64 2019-01-14 22:21:26 -08:00
rodzic b279f16025
commit 2c18a0c9f4
1 zmienionych plików z 7 dodań i 6 usunięć

Wyświetl plik

@ -1,5 +1,6 @@
import glob
import zipfile
import os
import shutil
from pathlib import Path
from PyInstaller.building.api import PYZ, EXE, COLLECT
@ -8,7 +9,6 @@ from PyInstaller.building.datastruct import TOC
from corrscope import version as v
block_cipher = None
@ -103,14 +103,15 @@ exe = EXE(
)
class ZipCollect(COLLECT):
name: str # absolute-ish path, != __init__(name=)
name: str # dist/dir-name, != __init__(name=)
def assemble(self):
ret = super().assemble()
new_name = str(Path(self.name).with_name(app_name_version))
with zipfile.ZipFile(new_name + '.zip', 'w', zipfile.ZIP_DEFLATED) as z:
z.write(self.name)
# No file extension. (make_archive() adds extension)
zip_name = str(Path(self.name).with_name(app_name_version))
shutil.make_archive(zip_name, 'zip', self.name)
assert os.path.getsize(zip_name + '.zip') > 2**20
return ret