From 036f7ba5e4a78f63f3a6b63968fbd9eae42375d5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 10 Oct 2023 22:14:35 +0530 Subject: [PATCH] More WiX porting --- bypy/windows/__main__.py | 2 +- bypy/windows/en-us.xml | 14 ++++++-------- bypy/windows/wix.py | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/bypy/windows/__main__.py b/bypy/windows/__main__.py index 3490f16cbc..1122a3a0b6 100644 --- a/bypy/windows/__main__.py +++ b/bypy/windows/__main__.py @@ -575,7 +575,7 @@ def main(): run_tests(os.path.join(env.base, 'calibre-debug.exe'), env.base) if args.sign_installers: sign_executables(env) - create_installer(env) + create_installer(env, args.compression_level) build_portable(env) build_portable_installer(env) if args.sign_installers: diff --git a/bypy/windows/en-us.xml b/bypy/windows/en-us.xml index 9c47b99dbe..2a2b88d0a5 100644 --- a/bypy/windows/en-us.xml +++ b/bypy/windows/en-us.xml @@ -1,9 +1,7 @@ - - - Click Advanced to change installation settings. - Computing space requirements, this may take up to five minutes... - Computing space requirements, this may take up to five minutes... - Computing space requirements, this may take up to five minutes... - Please wait while the installer finishes determining your disk space requirements, this may take up to five minutes... + + + + + + - diff --git a/bypy/windows/wix.py b/bypy/windows/wix.py index 20fd050d04..5e101dc21e 100644 --- a/bypy/windows/wix.py +++ b/bypy/windows/wix.py @@ -9,7 +9,6 @@ import shutil from bypy.constants import is64bit from bypy.utils import run -# TODO: Migrate to Wix 4 see https://wixtoolset.org/docs/fourthree/ WIX = os.path.expanduser('~/.dotnet/tools/wix.exe') if is64bit: UPGRADE_CODE = '5DD881FF-756B-4097-9D82-8C0F11D521EA' @@ -20,7 +19,12 @@ calibre_constants = globals()['calibre_constants'] j, d, a, b = os.path.join, os.path.dirname, os.path.abspath, os.path.basename -def create_installer(env): +def create_installer(env, compression_level='9'): + cl = int(compression_level) + if cl > 4: + dcl = 'high' + else: + dcl = {1: 'none', 2: 'low', 3: 'medium', 4: 'mszip'}[cl] if os.path.exists(env.installer_dir): shutil.rmtree(env.installer_dir) os.makedirs(env.installer_dir) @@ -58,8 +62,12 @@ def create_installer(env): license = j(env.src_root, 'LICENSE.rtf') banner = j(env.src_root, 'icons', 'wix-banner.bmp') dialog = j(env.src_root, 'icons', 'wix-dialog.bmp') - cmd = [WIX, 'build', '-arch', arch, '-culture', 'en-us', '-loc', enusf, - '-d', 'WixUILicenseRtf=' + license, '-d', 'WixUIBannerBmp=' + banner, '-d', 'WixUIDialogBmp=' + dialog, '-o', installer] + run(WIX, 'extension', 'add', '-g', 'WixToolset.Util.wixext') + run(WIX, 'extension', 'add', '-g', 'WixToolset.UI.wixext') + cmd = [WIX, 'build', '-arch', arch, '-culture', 'en-us', '-loc', enusf, '-dcl', dcl, + '-ext', 'WixToolset.Util.wixext', '-ext', 'WixToolset.UI.wixext', + '-d', 'WixUILicenseRtf=' + license, '-d', 'WixUIBannerBmp=' + banner, '-d', 'WixUIDialogBmp=' + dialog, + '-o', installer, wxsf] run(*cmd)