Workaround wix adding of extensions being utterly broken

This commit is contained in:
Kovid Goyal 2024-04-06 11:59:25 +05:30
parent a61b62e0f2
commit 788e21fd03
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -19,6 +19,11 @@ calibre_constants = globals()['calibre_constants']
j, d, a, b = os.path.join, os.path.dirname, os.path.abspath, os.path.basename
def add_wix_extension(name):
if not os.path.exists(os.path.expanduser(f'~/.wix/extensions/{name}')):
run(WIX, 'extension', 'add', '-g', name)
def create_installer(env, compression_level='9'):
cl = int(compression_level)
if cl > 4:
@ -62,8 +67,8 @@ def create_installer(env, compression_level='9'):
arch = 'x64' if is64bit else 'x86'
installer = j(env.dist, '%s%s-%s.msi' % (
calibre_constants['appname'], ('-64bit' if is64bit else ''), calibre_constants['version']))
run(WIX, 'extension', 'add', '-g', 'WixToolset.Util.wixext')
run(WIX, 'extension', 'add', '-g', 'WixToolset.UI.wixext')
add_wix_extension('WixToolset.Util.wixext')
add_wix_extension( 'WixToolset.UI.wixext')
cmd = [WIX, 'build', '-arch', arch, '-culture', 'en-us', '-loc', enusf, '-dcl', dcl,
'-ext', 'WixToolset.Util.wixext', '-ext', 'WixToolset.UI.wixext', '-o', installer, wxsf]
run(*cmd)