Beispiel #1
0
    def _add_get_install_dir_from_registry(self):
        name = self._package_var().replace(' ', '')
        if isinstance(self.package, InstallerPackage):
            name = self.package.windows_sdk_reg or name

        key = self._registry_key(name)

        # Get INSTALLDIR from the registry key
        installdir_prop = etree.SubElement(self.product,
                                           'Property',
                                           Id='INSTALLDIR')
        etree.SubElement(installdir_prop,
                         'RegistrySearch',
                         Id=name,
                         Type="raw",
                         Root=self.REG_ROOT,
                         Key=key,
                         Name='InstallDir')
Beispiel #2
0
 def _customize_ui(self):
     # Banner Dialog and License
     for path, var in [(self.BANNER_BMP, 'BannerBmp'),
                       (self.DIALOG_BMP, 'DialogBmp'),
                       (self.LICENSE_RTF, 'LicenseRtf')]:
         path = self.package.relative_path(path)
         if os.path.exists(path):
             etree.SubElement(self.product,
                              'WixVariable',
                              Id='WixUI%s' % var,
                              Value=path)
     # Icon
     path = self.package.relative_path(self.ICON)
     if os.path.exists(path):
         etree.SubElement(self.product,
                          'Icon',
                          Id='MainIcon',
                          SourceFile=path)
Beispiel #3
0
    def _add_application_merge_module(self):
        self.main_feature = etree.SubElement(
            self.product,
            "Feature",
            Id=self._format_id(self.package.name + '_app'),
            Title=self.package.title,
            Level='1',
            Display="expand",
            AllowAdvertise="no",
            ConfigurableDirectory="INSTALLDIR")

        self._add_merge_module(self.package, True, True, [])

        etree.SubElement(self.installdir,
                         'Merge',
                         Id=self._package_id(self.package.name),
                         Language='1033',
                         SourceFile=self.packages_deps[self.package],
                         DiskId='1')
Beispiel #4
0
 def _add_sdk_root_env_variable(self):
     envcomponent = etree.SubElement(self.installdir,
                                     'Component',
                                     Id='EnvironmentVariables',
                                     Guid=self._get_uuid())
     # archdir has to be toolchain-specific: mingw_x86_64, uwp-debug_arm64, etc
     platform_arch = self.config._get_toolchain_target_platform_arch()
     root_env_var = self.package.get_root_env_var(platform_arch)
     env = etree.SubElement(envcomponent,
                            'Environment',
                            Id="SdkRootEnv",
                            Action="set",
                            Part="all",
                            Name=root_env_var,
                            Permanent="no",
                            Value='[SDKROOTDIR]')
     etree.SubElement(self.main_feature,
                      'ComponentRef',
                      Id='EnvironmentVariables')
Beispiel #5
0
    def _add_file(self, filepath):
        dirpath, filename = os.path.split(filepath)
        self._add_directory(dirpath)
        dirnode = self._dirnodes[dirpath]

        component = etree.SubElement(dirnode,
                                     'Component',
                                     Id=self._format_path_id(filepath),
                                     Guid=self._get_uuid())

        filepath = os.path.join(self.prefix, filepath)
        p_id = self._format_path_id(filepath, True)
        if self._with_wine:
            filepath = to_winepath(filepath)
        etree.SubElement(component,
                         'File',
                         Id=p_id,
                         Name=filename,
                         Source=filepath)
Beispiel #6
0
 def _add_ui_customization(self):
     resources = etree.SubElement(self.root, self.TAG_RESOURCES)
     resources.set(self.ATTR_BG_ALIGN, "left")
     resources.set(self.ATTR_BG_SCALE, "none")
     locale = etree.SubElement(resources, self.TAG_LOCALE, lang='en')
     path = self.package.resources_background
     if os.path.exists(path):
         background = etree.SubElement(locale,
                                       self.TAG_RESOURCE,
                                       mod='true',
                                       type='background')
         background.text = path
     path = self.package.resources_license_unwrapped
     if os.path.exists(path):
         license = etree.SubElement(locale,
                                    self.TAG_RESOURCE,
                                    mod='true',
                                    type='license')
         license.text = path
Beispiel #7
0
 def _add_choice(self, package, enabled, selected, contents):
     choice = etree.SubElement(contents,
                               self.TAG_CHOICE,
                               title=package.shortdesc,
                               id=package.name,
                               starts_selected=self._boolstr(selected),
                               starts_enabled=self._boolstr(enabled),
                               starts_hidden='false')
     packages = [package] + self.store.get_package_deps(package)
     for package in packages:
         if package in self.emptypkgs:
             continue
         etree.SubElement(choice, self.TAG_PKGREF, id=package.identifier())
         if package not in self.packagerefs:
             item = etree.SubElement(self.root,
                                     self.TAG_ITEM,
                                     type='pkgref')
             item.text = '%s.xml' % package.name
             self.packagerefs.append(package)
Beispiel #8
0
    def _add_merge_modules(self):
        self.main_feature = etree.SubElement(
            self.product,
            "Feature",
            Id=self._format_id(self.package.name),
            Title=self.package.title,
            Level='1',
            Display="expand",
            AllowAdvertise="no",
            ConfigurableDirectory="INSTALLDIR")

        packages = [(self.store.get_package(x[0]), x[1], x[2])
                    for x in self.package.packages]

        # Remove empty packages
        packages = [
            x for x in packages if x[0] in list(self.packages_deps.keys())
        ]
        if len(packages) == 0:
            raise FatalError("All packages are empty: %s" %
                             [x[0] for x in self.package.packages])

        # Fill the list of required packages, which are the ones installed by
        # a package that is always installed
        req = [x[0] for x in packages if x[1] == True]
        required_packages = req[:]
        for p in req:
            required_packages.extend(self.store.get_package_deps(p, True))

        for package, required, selected in packages:
            if package in self.packages_deps:
                self._add_merge_module(package, required, selected,
                                       required_packages)

        # Add a merge module ref for all the packages
        for package, path in self.packages_deps.items():
            etree.SubElement(self.installdir,
                             'Merge',
                             Id=self._package_id(package.name),
                             Language='1033',
                             SourceFile=path,
                             DiskId='1')
Beispiel #9
0
    def _add_file(self, filepath):
        dirpath, filename = os.path.split(filepath)
        self._add_directory(dirpath)
        dirid = self._dirids[dirpath]

        component = etree.SubElement(self.component_group,
                                     'Component',
                                     Id=self._format_dir_id(
                                         self.package.name, filepath),
                                     Guid=self._get_uuid(),
                                     Directory=dirid)
        filepath = os.path.join(self.prefix, filepath)
        p_id = self._format_dir_id(self.package.name, filepath, True)
        if self._with_wine:
            filepath = to_winepath(filepath)
        etree.SubElement(component,
                         'File',
                         Id=p_id,
                         Name=filename,
                         Source=filepath)
Beispiel #10
0
 def _add_package_root(self):
     self.proot = etree.SubElement(self.root,
                                   self.TAG_F,
                                   n='PackageRoot',
                                   o=self.OWNER,
                                   g=self.GROUP,
                                   pt='.',
                                   m='true',
                                   t='bom',
                                   p='16877')
     for mod in ['name']:
         self._subelement_text(self.proot, self.TAG_MOD, mod)
     return self.proot
Beispiel #11
0
    def _add_contents(self):
        contents = etree.SubElement(self.root, self.TAG_CONTENTS)

        choices = []
        for p, required, selected in self.package.packages:
            if p in choices:
                continue
            choices.append(p)
            package = self.store.get_package(p)
            package.set_mode(self.package_type)
            if package in self.emptypkgs:
                continue
            self._add_choice(package, not required, selected, contents)
Beispiel #12
0
    def _add_directory(self, dirpath):
        if dirpath in self._dirnodes:
            return
        parentpath = os.path.split(dirpath)[0]
        if parentpath == []:
            parentpath = ['']

        if parentpath not in self._dirnodes:
            self._add_directory(parentpath)

        parent = self._dirnodes[parentpath]
        dirnode = etree.SubElement(parent,
                                   "Directory",
                                   Id=self._format_path_id(dirpath),
                                   Name=os.path.split(dirpath)[1])
        self._dirnodes[dirpath] = dirnode
Beispiel #13
0
    def _add_start_menu_shortcuts(self):
        key = self.package.get_wix_registry_key()

        # 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)')
        # Add the shortcut to the installer package
        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',
                         On='uninstall')
        etree.SubElement(apps,
                         'RegistryValue',
                         Root='HKLM',
                         Key=key,
                         Name='InstallDir',
                         Type='string',
                         Value='[INSTALLDIR]')
        # Ref it in the main feature
        etree.SubElement(self.main_feature,
                         'ComponentRef',
                         Id='ApplicationShortcut')
Beispiel #14
0
 def _add_config(self):
     config = etree.SubElement(self.root, self.TAG_CONFIG)
     self._subelement_text(config, self.TAG_VERSION, '1.0')
     self._subelement_text(config, self.TAG_IDENTIFIER,
                           self.package.identifier())
     self._subelement_text(config, self.TAG_DESCRIPTION,
                           self.package.shortdesc)
     etree.SubElement(config, self.TAG_POST_INSTALL, type="none")
     etree.SubElement(config, self.TAG_REQ_AUTH)
     self._subelement_text(config,
                           self.TAG_INSTALL_TO,
                           '.',
                           relative="true",
                           mod="true")
     etree.SubElement(config, self.TAG_PACKAGE_STORE, type="internal")
     self._add_mods(config, [
         'installTo.isAbsoluteType', 'installTo.path',
         'installTo.isRelativeType', 'installTo', 'parent', 'version',
         'identifier'
     ])
     flags = etree.SubElement(config, self.TAG_FLAGS)
     etree.SubElement(flags, self.TAG_FOLLOW_SYMLINKS)
Beispiel #15
0
    def _add_registry_install_dir(self):
        # Get the package name. Both devel and runtime will share the same
        # installation folder
        name = self._package_var().replace(' ', '')

        # Add INSTALLDIR in the registry only for the runtime package
        if self.package.package_mode == PackageType.RUNTIME:
            regcomponent = etree.SubElement(self.installdir,
                                            'Component',
                                            Id='RegistryInstallDir',
                                            Guid=self._get_uuid())
            regkey = etree.SubElement(regcomponent,
                                      'RegistryKey',
                                      Id='RegistryInstallDirRoot',
                                      ForceCreateOnInstall='yes',
                                      ForceDeleteOnUninstall='yes',
                                      Key=self._registry_key(name),
                                      Root=self.REG_ROOT)
            etree.SubElement(regkey,
                             'RegistryValue',
                             Id='RegistryInstallDirValue',
                             Type='string',
                             Name='InstallDir',
                             Value='[INSTALLDIR]')
            etree.SubElement(regkey,
                             'RegistryValue',
                             Id='RegistryVersionValue',
                             Type='string',
                             Name='Version',
                             Value=self.package.version)
            etree.SubElement(regkey,
                             'RegistryValue',
                             Id='RegistrySDKVersionValue',
                             Type='string',
                             Name='SdkVersion',
                             Value=self.package.sdk_version)
            etree.SubElement(self.main_feature,
                             'ComponentRef',
                             Id='RegistryInstallDir')
Beispiel #16
0
 def _add_dir(self, parent, dir_id, name):
     tdir = etree.SubElement(parent, "Directory", Id=dir_id, Name=name)
     return tdir
Beispiel #17
0
 def _add_linker_props(self):
     self.linker = etree.SubElement(self.item_definition_group, 'Link')
Beispiel #18
0
 def _add_root_dir(self):
     self.rdir = etree.SubElement(self.fragment,
                                  "DirectoryRef",
                                  Id='SDKROOTDIR')
     self._dirnodes[''] = self.rdir
Beispiel #19
0
 def _add_mods(self, parent, mods):
     for mod in mods:
         el = etree.SubElement(parent, self.TAG_MOD)
         el.text = mod
Beispiel #20
0
 def _add_fragment(self):
     self.fragment = etree.SubElement(self.root, "Fragment")
Beispiel #21
0
 def _add_component_group(self):
     self.component_group = etree.SubElement(self.fragment,
                                             "ComponentGroup",
                                             Id=self._format_group_id(
                                                 self.package.name))
Beispiel #22
0
 def _add_sdk_root_macro(self, prefix, prefix_macro):
     etree.SubElement(self.root, 'Macro', Name=prefix_macro,
                      Value=to_winpath(prefix))
Beispiel #23
0
 def _subelement_text(self, parent, tag, text, **attrib):
     el = etree.SubElement(parent, tag, **attrib)
     el.text = text
     return el
Beispiel #24
0
 def _add_root_dir(self):
     self.rdir = etree.SubElement(self.module,
                                  "Directory",
                                  Id='TARGETDIR',
                                  Name='SourceDir')
     self._dirnodes[''] = self.rdir
Beispiel #25
0
 def _add_tool(self, name, **kwargs):
     etree.SubElement(self.root, 'Tool', Name=name, **kwargs)
Beispiel #26
0
 def _import_property(self, name):
     cond = '$(%sImported)!=true' % self._format_name(name)
     etree.SubElement(self.import_group,
                      'Import',
                      Condition=cond,
                      Project='%s.props' % name)
Beispiel #27
0
 def _add_var(self, parent, name, content):
     el = etree.SubElement(parent, name)
     el.text = content + ';%%(%s)' % name
Beispiel #28
0
 def _add_compiler_props(self):
     self.compiler = etree.SubElement(self.item_definition_group,
                                      'ClCompile')
Beispiel #29
0
 def _add_vs_properties(self):
     etree.SubElement(self.product, 'PropertyRef', Id='VS2010DEVENV')
     etree.SubElement(self.product, 'PropertyRef', Id='VC2010EXPRESS_IDE')
Beispiel #30
0
 def _add_imported_variable(self):
     el = etree.SubElement(self.property_group,
                           '%sImported' % self._format_name(self.name))
     el.text = 'true'