mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Start work on porting wix
This commit is contained in:
parent
2e859bab02
commit
85d899461d
@ -1,4 +1,4 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
|
||||
>
|
||||
|
||||
@ -60,12 +60,8 @@
|
||||
</Property>
|
||||
|
||||
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||
<Directory Id='{ProgramFilesFolder}' Name='PFiles'>
|
||||
<!-- The name must be calibre on 32 bit to ensure
|
||||
that the component guids dont change compared to previous msis.
|
||||
However, on 64 bit it must be Calibre2 otherwise by default it
|
||||
will install to C:\Program Files\calibre -->
|
||||
<Directory Id='APPLICATIONFOLDER' Name="{appfolder}" />
|
||||
<Directory Id='ProgramFiles64Folder' Name='PFiles'>
|
||||
<Directory Id='APPLICATIONFOLDER' Name="Calibre2" />
|
||||
</Directory>
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="{app}{x64} - E-book Management"/>
|
||||
@ -195,12 +191,12 @@
|
||||
|
||||
<InstallExecuteSequence>
|
||||
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
|
||||
{fix_wix}
|
||||
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
|
||||
<RemoveExistingProducts After="InstallFinalize" />
|
||||
</InstallExecuteSequence>
|
||||
<InstallUISequence>
|
||||
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
|
||||
{fix_wix}
|
||||
<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />
|
||||
</InstallUISequence>
|
||||
|
||||
<UI>
|
||||
|
@ -10,15 +10,13 @@ from bypy.constants import is64bit
|
||||
from bypy.utils import run
|
||||
|
||||
# TODO: Migrate to Wix 4 see https://wixtoolset.org/docs/fourthree/
|
||||
WIXP = r'C:\Program Files (x86)\WiX Toolset v3.14'
|
||||
WIX = os.path.expanduser('~/.dotnet/tools/wix.exe')
|
||||
if is64bit:
|
||||
UPGRADE_CODE = '5DD881FF-756B-4097-9D82-8C0F11D521EA'
|
||||
else:
|
||||
UPGRADE_CODE = 'BEB2A80D-E902-4DAD-ADF9-8BD2DA42CFE1'
|
||||
calibre_constants = globals()['calibre_constants']
|
||||
|
||||
CANDLE = WIXP + r'\bin\candle.exe'
|
||||
LIGHT = WIXP + r'\bin\light.exe'
|
||||
j, d, a, b = os.path.join, os.path.dirname, os.path.abspath, os.path.basename
|
||||
|
||||
|
||||
@ -33,12 +31,9 @@ def create_installer(env):
|
||||
components, smap = get_components_from_files(env)
|
||||
wxs = template.format(
|
||||
app=calibre_constants['appname'],
|
||||
appfolder='Calibre2' if is64bit else 'Calibre',
|
||||
version=calibre_constants['version'],
|
||||
upgrade_code=UPGRADE_CODE,
|
||||
ProgramFilesFolder='ProgramFiles64Folder' if is64bit else 'ProgramFilesFolder',
|
||||
x64=' 64bit' if is64bit else '',
|
||||
fix_wix='<Custom Action="OverwriteWixSetDefaultPerMachineFolder" After="WixSetDefaultPerMachineFolder" />' if is64bit else '',
|
||||
compression='high',
|
||||
app_components=components,
|
||||
exe_map=smap,
|
||||
@ -57,28 +52,16 @@ def create_installer(env):
|
||||
f.write(wxs.encode('utf-8'))
|
||||
with open(enusf, 'wb') as f:
|
||||
f.write(enus.encode('utf-8'))
|
||||
wixobj = j(env.installer_dir, calibre_constants['appname'] + '.wixobj')
|
||||
arch = 'x64' if is64bit else 'x86'
|
||||
cmd = [CANDLE, '-nologo', '-arch', arch, '-ext', 'WiXUtilExtension', '-o', wixobj, wxsf]
|
||||
run(*cmd)
|
||||
installer = j(env.dist, '%s%s-%s.msi' % (
|
||||
calibre_constants['appname'], ('-64bit' if is64bit else ''), calibre_constants['version']))
|
||||
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 = [LIGHT, '-nologo', '-ext', 'WixUIExtension',
|
||||
'-cultures:en-us', '-loc', enusf, wixobj,
|
||||
'-ext', 'WixUtilExtension',
|
||||
'-o', installer,
|
||||
cmd = [WIX, 'build', '-arch', arch, '-culture', 'en-us', '-loc', enusf, '-o', installer,
|
||||
'-dWixUILicenseRtf=' + license,
|
||||
'-dWixUIBannerBmp=' + banner,
|
||||
'-dWixUIDialogBmp=' + dialog]
|
||||
cmd.extend([
|
||||
'-sice:ICE60', # No language in dlls warning
|
||||
'-sice:ICE61', # Allow upgrading with same version number
|
||||
'-sice:ICE40', # Re-install mode overridden
|
||||
'-sice:ICE69', # Shortcut components are part of a different feature than the files they point to
|
||||
])
|
||||
cmd.append('-sval') # Disable all checks since they fail when running under ssh
|
||||
run(*cmd)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user