diff --git a/bypy/windows/wix.py b/bypy/windows/wix.py index 5c93e21c4b..6eb2f88018 100644 --- a/bypy/windows/wix.py +++ b/bypy/windows/wix.py @@ -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)