Add --compression-level to installer build commands

This commit is contained in:
Kovid Goyal 2020-09-30 19:34:43 +05:30
parent eb824ef094
commit f42b0b9f59
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -26,7 +26,7 @@ def get_exe():
return 'python3' if sys.version_info.major == 2 else sys.executable
def get_cmd(exe, bypy, which, bitness, sign_installers, notarize=True):
def get_cmd(exe, bypy, which, bitness, sign_installers, notarize=True, compression_level='9'):
cmd = [exe, bypy, which]
if bitness and bitness == '32':
cmd.append(bitness)
@ -37,6 +37,7 @@ def get_cmd(exe, bypy, which, bitness, sign_installers, notarize=True):
cmd.append('--sign-installers')
if notarize:
cmd.append('--notarize')
cmd.append('--compression-level=' + compression_level)
return cmd
@ -67,10 +68,10 @@ def build_only(which, bitness, spec, shutdown=False):
return dist
def build_single(which='windows', bitness='64', shutdown=True, sign_installers=True, notarize=True):
def build_single(which='windows', bitness='64', shutdown=True, sign_installers=True, notarize=True, compression_level='9'):
base, bypy = get_paths()
exe = get_exe()
cmd = get_cmd(exe, bypy, which, bitness, sign_installers, notarize)
cmd = get_cmd(exe, bypy, which, bitness, sign_installers, notarize, compression_level=compression_level)
ret = subprocess.Popen(cmd).wait()
if ret != 0:
raise SystemExit(ret)
@ -123,9 +124,19 @@ class BuildInstaller(Command):
action='store_true',
help='Do not notarize the installers'
)
parser.add_option(
'--compression-level',
default='9',
choices=list('123456789'),
help='Do not notarize the installers'
)
def run(self, opts):
build_single(self.OS, self.BITNESS, not opts.dont_shutdown, not opts.dont_sign, not opts.dont_notarize)
build_single(
self.OS, self.BITNESS, not opts.dont_shutdown,
not opts.dont_sign, not opts.dont_notarize,
compression_level=opts.compression_level
)
class BuildInstallers(BuildInstaller):