kopia lustrzana https://github.com/corrscope/corrscope
Switch to 7z archiving, to compress 64-bit binaries further
rodzic
2c18a0c9f4
commit
d0ac89325f
|
@ -1,6 +1,7 @@
|
|||
import glob
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
||||
|
@ -102,16 +103,22 @@ exe = EXE(
|
|||
console=True,
|
||||
)
|
||||
|
||||
|
||||
class ZipCollect(COLLECT):
|
||||
name: str # dist/dir-name, != __init__(name=)
|
||||
name: str # dist/dir-name, != __init__(name=)
|
||||
|
||||
def assemble(self):
|
||||
ret = super().assemble()
|
||||
|
||||
# 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
|
||||
if shutil.which("7z"):
|
||||
cmd_7z = "7z a -mx=3".split()
|
||||
|
||||
# Don't use Path.with_suffix(), it removes trailing semver components.
|
||||
out_name = str(Path(self.name).with_name(app_name_version)) + ".7z"
|
||||
in_files = f"{self.name}/*" # asterisk removes root directory from archive
|
||||
|
||||
subprocess.run(cmd_7z + [out_name, in_files], check=True)
|
||||
assert os.path.getsize(out_name) > 2 ** 20
|
||||
|
||||
return ret
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue