diff options
author | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-11-16 12:08:21 +0100 |
---|---|---|
committer | Andoni Morales Alastruey <ylatuya@gmail.com> | 2012-11-16 12:25:52 +0100 |
commit | 826d69460b4c547777e8be641748b39e40383ecb (patch) | |
tree | 1a9bab17fe151b69fb09e5b96ca9db782b6c3e37 | |
parent | a9d314f65724995181bd3ae4b34bd5c5995e7144 (diff) |
wix: add support for menu shortcuts
-rw-r--r-- | cerbero/packages/wix.py | 35 | ||||
-rw-r--r-- | cerbero/packages/wix_packager.py | 2 | ||||
-rw-r--r-- | data/wix/Config.wxi | 1 | ||||
-rw-r--r-- | data/wix/installer.wxs | 2 |
4 files changed, 26 insertions, 14 deletions
diff --git a/cerbero/packages/wix.py b/cerbero/packages/wix.py index 310e68d..865b09e 100644 --- a/cerbero/packages/wix.py +++ b/cerbero/packages/wix.py @@ -186,6 +186,10 @@ class WixConfig(WixBase): self.config_path = os.path.join(config.data_dir, self.wix_config) self.arch = config.target_arch self.package = package + if isinstance(self.package, App): + self.ui_type = 'WixUI_InstallDir' + else: + self.ui_type = 'WixUI_Mondo' def write(self, output_dir): config_out_path = os.path.join(output_dir, @@ -203,7 +207,9 @@ class WixConfig(WixBase): "@ProjectURL": self.package.url, "@ProductName@": self._product_name(), "@ProgramFilesFolder@": self._program_folder(), - "@Platform@": self._platform()} + "@Platform@": self._platform(), + "@UIType@": self.ui_type + } shell.replace(config_out_path, replacements) return config_out_path @@ -334,6 +340,7 @@ class MSI(WixBase): '$(var.PlatformProgramFilesFolder)', 'ProgramFilesFolder') self.installdir = self._add_dir(installdir, 'INSTALLDIR', '$(var.ProductName)') + self.bindir = self._add_dir(self.installdir, 'INSTALLBINDIR', 'bin') else: installdir = self._add_dir(self.target_dir, 'INSTALLDIR', self.package.get_install_dir()) @@ -449,20 +456,24 @@ class MSI(WixBase): etree.SubElement(feature, "MergeRef", Id=self._package_id(package.name)) - def _add_start_menu_shortcuts(self, package): + def _add_start_menu_shortcuts(self): # Create a folder with the application name in the Start Menu folder - programs = etree.SubElement(self.target_dir, 'Directory', Id='ProgramMenuFolder') - etree.subElement(programs, 'Directory', Id='ApplicationProgramsFolder', - Name='$(var.ProductName') + programs = etree.SubElement(self.target_dir, 'Directory', + Id='ProgramMenuFolder') + etree.SubElement(programs, 'Directory', Id='ApplicationProgramsFolder', + Name='$(var.ProductName)') # Add the shortcut to the installer package - appf = etree.SubElement(self.root, 'DirectoryRef', Id='ApplicationProgramsFolder') - apps = etree.SubElement(appf, 'Component', Id='ApplicationShortcut', Guid=self._get_uuid()) - for desc, path in package.commands: - etree.SubElement(apps, 'Shortcut', Id='ApplicationStartMenuShortcut', - Name=desc, Description=desc, Target='[SDKROOTDIR]' + path, - WorkingDirectory='[SDKROOTDIR]' + os.path.dirname(path), + appf = etree.SubElement(self.product, 'DirectoryRef', + Id='ApplicationProgramsFolder') + apps = etree.SubElement(appf, 'Component', Id='ApplicationShortcut', + Guid=self._get_uuid()) + for desc, path, _, _ in self.package.commands[self.config.target_platform]: + etree.SubElement(apps, 'Shortcut', + Id='ApplicationStartMenuShortcut', Name=desc, + Description=desc, Target='[INSTALLBINDIR]' + path, + WorkingDirectory='INSTALLBINDIR', Icon='MainIcon') - etree.SubElement(apps, 'Removefolder', Id='ApplicationProgramsFolder', + etree.SubElement(apps, 'RemoveFolder', Id='ApplicationProgramsFolder', On='uninstall') etree.SubElement(apps, 'RegistryValue', Root='HKCU', Key='Software\Microsoft\%s' % self.package.name, diff --git a/cerbero/packages/wix_packager.py b/cerbero/packages/wix_packager.py index 40bf675..a43357f 100644 --- a/cerbero/packages/wix_packager.py +++ b/cerbero/packages/wix_packager.py @@ -111,7 +111,7 @@ class MSIPackager(PackagerBase): paths.append(p) # create devel package - if devel: + if devel and not isinstance(self.package, App): p = self._create_msi_installer(PackageType.DEVEL) paths.append(p) diff --git a/data/wix/Config.wxi b/data/wix/Config.wxi index 3926c82..45c4747 100644 --- a/data/wix/Config.wxi +++ b/data/wix/Config.wxi @@ -12,5 +12,6 @@ <?define ProductName = "@ProductName@" ?> <?define PlatformProgramFilesFolder = "@ProgramFilesFolder@" ?> <?define Platform = "@Platform@" ?> +<?define UIType = "@UIType@" ?> </Include> diff --git a/data/wix/installer.wxs b/data/wix/installer.wxs index 8ac65a4..7366ab4 100644 --- a/data/wix/installer.wxs +++ b/data/wix/installer.wxs @@ -27,6 +27,6 @@ </InstallUISequence> <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"/> - <UIRef Id="WixUI_Mondo"/> + <UIRef Id="$(var.UIType)"/> </Product> </Wix> |