IGN:Fix Windows installer to correctly upgrade previous calibre installs

This commit is contained in:
Kovid Goyal 2009-10-16 21:42:36 -06:00
parent 77369380b1
commit d2618701ec
4 changed files with 29 additions and 10 deletions

View File

@ -20,7 +20,6 @@ class LinuxFreeze(Command):
from cx_Freeze import Executable, setup
from calibre.linux import entry_points
from calibre import walk
from calibre.web.feeds.recipes import recipe_modules
is64bit = platform.architecture()[0] == '64bit'
arch = 'x86_64' if is64bit else 'i686'
@ -110,7 +109,6 @@ class LinuxFreeze(Command):
packages = ['calibre', 'encodings', 'cherrypy', 'cssutils', 'xdg',
'dateutil', 'dns', 'email']
includes += ['calibre.web.feeds.recipes.'+r for r in recipe_modules]
includes += ['calibre.gui2.convert.'+x.split('/')[-1].rpartition('.')[0] for x in \
glob.glob('src/calibre/gui2/convert/*.py')]

View File

@ -141,7 +141,9 @@ class Win32Freeze(Command, WixMixIn):
shutil.copytree(x, self.j(sp_dir, self.b(x)))
for x in (r'calibre\manual', r'calibre\trac', 'pythonwin'):
shutil.rmtree(self.j(sp_dir, x))
deld = self.j(sp_dir, x)
if os.path.exists(deld):
shutil.rmtree(deld)
for x in os.walk(self.j(sp_dir, 'calibre')):
for f in x[-1]:

View File

@ -2,14 +2,29 @@
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi' xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
>
<Product Name='{app}' Id='{product_guid}' UpgradeCode='{upgrade_code}'
<Product Name='{app}' Id='*' UpgradeCode='{upgrade_code}'
Language='1033' Codepage='1252' Version='{version}' Manufacturer='Kovid Goyal'>
<Package Id='*' Keywords='Installer' Description="{app} Installer"
Comments='{app} is a registered trademark of Kovid Goyal' Manufacturer='Kovid Goyal'
InstallerVersion='300' Languages='1033' Compressed='yes'
SummaryCodepage='1252' />
<Media Id="1" Cabinet="{app}.cab" CompressionLevel="{compression}" EmbedCab="yes" />
<Upgrade Id="{upgrade_code}">
<UpgradeVersion Maximum="{version}"
IncludeMaximum="yes"
OnlyDetect="no"
Language="1033"
Property="OLDPRODUCTFOUND"/>
<UpgradeVersion Minimum="{version}"
IncludeMinimum="no"
OnlyDetect="yes"
Language="1033"
Property="NEWPRODUCTFOUND"/>
</Upgrade>
<CustomAction Id="PreventDowngrading" Error="Newer version already installed."/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Merge Id="VCRedist" SourceFile="{crt_msm}" DiskId="1" Language="0"/>
@ -102,7 +117,14 @@
<Condition
Message="This application is only supported on Windows XP SP2, or higher.">
<![CDATA[Installed OR (VersionNT >= 501)]]>
</Condition>
</Condition>
<InstallExecuteSequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
<RemoveExistingProducts Before="InstallInitialize" />
</InstallExecuteSequence>
<InstallUISequence>
<Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWPRODUCTFOUND</Custom>
</InstallUISequence>
<UI>
<UIRef Id="WixUI_Advanced" />

View File

@ -6,12 +6,10 @@ __license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, uuid, shutil, subprocess
import os, shutil, subprocess
from setup import __appname__, __version__, basenames
guid = uuid.uuid4 # Random GUID
WIXP = r'C:\Program Files\Windows Installer XML v3.5'
CANDLE = WIXP+r'\bin\candle.exe'
LIGHT = WIXP+r'\bin\light.exe'
@ -31,8 +29,7 @@ class WixMixIn:
wxs = template.format(
app = __appname__,
version = __version__,
product_guid = guid(),
upgrade_code = guid(),
upgrade_code = 'BEB2A80D-E902-4DAD-ADF9-8BD2DA42CFE1',
compression = self.opts.msi_compression,
app_components = components,
exe_map = self.smap,