Windows installer: Add some extra info to the registry

This commit is contained in:
Kovid Goyal 2012-12-01 16:42:41 +05:30
parent bf46edf785
commit 49bca5e19b
4 changed files with 23 additions and 6 deletions

View File

@ -11,12 +11,11 @@ from distutils.spawn import find_executable
from PyQt4 import pyqtconfig from PyQt4 import pyqtconfig
from setup import isosx, iswindows, islinux from setup import isosx, iswindows, islinux, is64bit
OSX_SDK = '/Developer/SDKs/MacOSX10.5.sdk' OSX_SDK = '/Developer/SDKs/MacOSX10.5.sdk'
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.5' os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.5'
is64bit = sys.maxsize > 2**32
NMAKE = RC = msvc = MT = win_inc = win_lib = win_ddk = win_ddk_lib_dirs = None NMAKE = RC = msvc = MT = win_inc = win_lib = win_ddk = win_ddk_lib_dirs = None
if iswindows: if iswindows:

View File

@ -31,6 +31,7 @@
</Upgrade> </Upgrade>
<CustomAction Id="PreventDowngrading" Error="Newer version already installed."/> <CustomAction Id="PreventDowngrading" Error="Newer version already installed."/>
<Property Id="ApplicationFolderName" Value="{appfolder}" />
<Property Id="APPLICATIONFOLDER"> <Property Id="APPLICATIONFOLDER">
<RegistrySearch Id='calibreInstDir' Type='raw' <RegistrySearch Id='calibreInstDir' Type='raw'
Root='HKLM' Key="Software\{app}{x64}\Installer" Name="InstallPath" /> Root='HKLM' Key="Software\{app}{x64}\Installer" Name="InstallPath" />
@ -38,7 +39,7 @@
<Directory Id='TARGETDIR' Name='SourceDir'> <Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='{ProgramFilesFolder}' Name='PFiles'> <Directory Id='{ProgramFilesFolder}' Name='PFiles'>
<Directory Id='APPLICATIONFOLDER' Name='{app}' /> <Directory Id='APPLICATIONFOLDER' Name="{appfolder}" />
</Directory> </Directory>
<Directory Id="ProgramMenuFolder"> <Directory Id="ProgramMenuFolder">
<Directory Id="ApplicationProgramsFolder" Name="{app}{x64} - E-book Management"/> <Directory Id="ApplicationProgramsFolder" Name="{app}{x64} - E-book Management"/>
@ -122,6 +123,10 @@
<!-- Add icon to entry in Add/Remove programs --> <!-- Add icon to entry in Add/Remove programs -->
<Icon Id="main_icon" SourceFile="{main_icon}"/> <Icon Id="main_icon" SourceFile="{main_icon}"/>
<Property Id="ARPPRODUCTICON" Value="main_icon" /> <Property Id="ARPPRODUCTICON" Value="main_icon" />
<Property Id="ARPURLINFOABOUT" Value="http://calibre-ebook.com" />
<Property Id='ARPHELPLINK' Value="http://calibre-ebook.com/help" />
<Property Id='ARPURLUPDATEINFO' Value="http://calibre-ebook.com/download_windows" />
<SetProperty Id="ARPINSTALLLOCATION" Value="[APPLICATIONFOLDER]" After="CostFinalize" />
<Condition <Condition
Message="This application is only supported on {minverhuman}, or higher."> Message="This application is only supported on {minverhuman}, or higher.">
@ -166,7 +171,6 @@
(i.e. per user installs should work) but left this way as I (i.e. per user installs should work) but left this way as I
dont want to deal with the complications dont want to deal with the complications
--> -->
<Property Id="ApplicationFolderName" Value="Calibre2" />
<Property Id="WixAppFolder" Value="WixPerMachineFolder" /> <Property Id="WixAppFolder" Value="WixPerMachineFolder" />
<Property Id="ALLUSERS" Value="1" /> <Property Id="ALLUSERS" Value="1" />
<WixVariable Id="WixUISupportPerUser" Value="0" /> <WixVariable Id="WixUISupportPerUser" Value="0" />

View File

@ -37,6 +37,7 @@ class WixMixIn:
components = self.get_components_from_files() components = self.get_components_from_files()
wxs = template.format( wxs = template.format(
app = __appname__, app = __appname__,
appfolder = 'Calibre2',
version = __version__, version = __version__,
upgrade_code = UPGRADE_CODE, upgrade_code = UPGRADE_CODE,
ProgramFilesFolder = 'ProgramFiles64Folder' if is64bit else 'ProgramFilesFolder', ProgramFilesFolder = 'ProgramFiles64Folder' if is64bit else 'ProgramFilesFolder',
@ -118,7 +119,20 @@ class WixMixIn:
(fid, f, x, checksum), (fid, f, x, checksum),
'</Component>' '</Component>'
] ]
components.append(''.join(c)) if x.endswith('.exe'):
# Add the executable to app paths so that users can
# launch it from the run dialog even if it is not on
# the path. See http://msdn.microsoft.com/en-us/library/windows/desktop/ee872121(v=vs.85).aspx
c[-1:-1] = [
('<RegistryValue Root="HKLM" '
'Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App '
'Paths\%s" Value="[#file_%d]" Type="string" />'%(x, fid)),
('<RegistryValue Root="HKLM" '
'Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App '
'Paths\{0}" Name="Path" Value="[APPLICATIONFOLDER]" '
'Type="string" />'.format(x)),
]
components.append('\n'.join(c))
return components return components
components = process_dir(os.path.abspath(self.base)) components = process_dir(os.path.abspath(self.base))

View File

@ -28,7 +28,7 @@ isunix = isosx or islinux
isportable = os.environ.get('CALIBRE_PORTABLE_BUILD', None) is not None isportable = os.environ.get('CALIBRE_PORTABLE_BUILD', None) is not None
ispy3 = sys.version_info.major > 2 ispy3 = sys.version_info.major > 2
isxp = iswindows and sys.getwindowsversion().major < 6 isxp = iswindows and sys.getwindowsversion().major < 6
is64bit = sys.maxint > (1 << 32) is64bit = sys.maxsize > (1 << 32)
isworker = os.environ.has_key('CALIBRE_WORKER') or os.environ.has_key('CALIBRE_SIMPLE_WORKER') isworker = os.environ.has_key('CALIBRE_WORKER') or os.environ.has_key('CALIBRE_SIMPLE_WORKER')
if isworker: if isworker:
os.environ.pop('CALIBRE_FORCE_ANSI', None) os.environ.pop('CALIBRE_FORCE_ANSI', None)