diff --git a/setup/installers.py b/setup/installers.py index 064f243c89..0bbea71442 100644 --- a/setup/installers.py +++ b/setup/installers.py @@ -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):