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 glob
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
||||||
|
@ -102,16 +103,22 @@ exe = EXE(
|
||||||
console=True,
|
console=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class ZipCollect(COLLECT):
|
class ZipCollect(COLLECT):
|
||||||
name: str # dist/dir-name, != __init__(name=)
|
name: str # dist/dir-name, != __init__(name=)
|
||||||
|
|
||||||
def assemble(self):
|
def assemble(self):
|
||||||
ret = super().assemble()
|
ret = super().assemble()
|
||||||
|
|
||||||
# No file extension. (make_archive() adds extension)
|
if shutil.which("7z"):
|
||||||
zip_name = str(Path(self.name).with_name(app_name_version))
|
cmd_7z = "7z a -mx=3".split()
|
||||||
shutil.make_archive(zip_name, 'zip', self.name)
|
|
||||||
assert os.path.getsize(zip_name + '.zip') > 2**20
|
# 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
|
return ret
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue