diff --git a/corrscope.spec b/corrscope.spec index e882ab0..2057b4d 100644 --- a/corrscope.spec +++ b/corrscope.spec @@ -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