kopia lustrzana https://github.com/corrscope/corrscope
Fix creation of PyInstaller zip files
rodzic
b279f16025
commit
2c18a0c9f4
|
@ -1,5 +1,6 @@
|
||||||
import glob
|
import glob
|
||||||
import zipfile
|
import os
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
||||||
|
@ -8,7 +9,6 @@ from PyInstaller.building.datastruct import TOC
|
||||||
|
|
||||||
from corrscope import version as v
|
from corrscope import version as v
|
||||||
|
|
||||||
|
|
||||||
block_cipher = None
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,14 +103,15 @@ exe = EXE(
|
||||||
)
|
)
|
||||||
|
|
||||||
class ZipCollect(COLLECT):
|
class ZipCollect(COLLECT):
|
||||||
name: str # absolute-ish path, != __init__(name=)
|
name: str # dist/dir-name, != __init__(name=)
|
||||||
|
|
||||||
def assemble(self):
|
def assemble(self):
|
||||||
ret = super().assemble()
|
ret = super().assemble()
|
||||||
|
|
||||||
new_name = str(Path(self.name).with_name(app_name_version))
|
# No file extension. (make_archive() adds extension)
|
||||||
with zipfile.ZipFile(new_name + '.zip', 'w', zipfile.ZIP_DEFLATED) as z:
|
zip_name = str(Path(self.name).with_name(app_name_version))
|
||||||
z.write(self.name)
|
shutil.make_archive(zip_name, 'zip', self.name)
|
||||||
|
assert os.path.getsize(zip_name + '.zip') > 2**20
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue