From f0b3ce65a16d487c0032bfe78078b26e90384079 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 10 Apr 2019 10:50:00 -0700 Subject: [PATCH] Fix up errors in builder --- builders/windows-builder.py | 27 +++++++++++++++------------ windows/OpenLP-base.wxs | 4 ++-- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 6b9cdf6..88ae839 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 ############################################################################### # OpenLP - Open Source Lyrics Projection # # --------------------------------------------------------------------------- # -# Copyright (c) 2004-2016 OpenLP Developers # +# Copyright (c) OpenLP Developers # # --------------------------------------------------------------------------- # # This program is free software; you can redistribute it and/or modify it # # under the terms of the GNU General Public License as published by the Free # @@ -36,7 +36,7 @@ PyEnchant This script expects the precompiled, installable version of PyEnchant to be installed. You can find this on the PyEnchant site. -Inno Setup 5 +WiX Toolset Inno Setup should be installed into "C:\\%PROGRAMFILES%\\Inno Setup 5" Sphinx @@ -140,7 +140,7 @@ class WindowsBuilder(Builder): if not parts: return dir_dict[search_key] else: - return walk_dirs(dir_dict[search_key], os.sep.join(parts)) + return self._walk_dirs(dir_dict[search_key], os.sep.join(parts)) else: return None @@ -164,21 +164,24 @@ class WindowsBuilder(Builder): dir_id = 'dir_{parent}_{base}'.format(parent=parent.replace(os.sep, '_'), base=base) element = E.Directory(Id=dir_id, Name=base) new_dir = {'__dir__': element} - parent_dir = walk_dirs(directories, parent) + parent_dir = self._walk_dirs(directories, parent) parent_dir[base] = new_dir parent_dir['__dir__'].append(element) for fname in files: if fname in BLACKLIST: continue source = os.path.join(path, fname) if path else fname - file_id = 'file_{source}'.format(source=source.replace('-', '_').replace(os.sep, '_')) + source_id = source.replace('-', '_').replace(os.sep, '_') + file_id = 'file_{source_id}'.format(source_id=source_id) + component_id = 'cmp_{source_id}'.format(source_id=source_id) file_ = E.File(Id=file_id, KeyPath="yes", Source=source) - component = E.Component(file_, Id='cmp_' + fixed_id, Guid='*') + component = E.Component(file_, Id=component_id, Guid='*') element.append(component) components.append(component) files_fragment = E.Fragment(directories[start_path]['__dir__']) - comps_fragment = E.Fragment(E.ComponentGroup(*[E.ComponentRef(Id=c.attrib['Id']) for c in components], Id='Files')) + comps_fragment = E.Fragment(E.ComponentGroup(*[E.ComponentRef(Id=c.attrib['Id']) for c in components], + Id='Files')) return files_fragment, comps_fragment def _create_wix_file(self): @@ -188,15 +191,15 @@ class WindowsBuilder(Builder): self._print('Creating WiX file...') config_dir = os.path.dirname(self.config_path) self._print_verbose('Reading base WiX file') - with open(os.path.join(config_dir, 'OpenLP-base.wxs'), 'rb') as base_file: + with open(os.path.join(config_dir, 'OpenLP-base.wxs'), 'rt') as base_file: xml = base_file.read() - xml = xml.format(dialog=os.path.join(config_dir, 'WizardMain.bmp'), + xml = xml % dict(dialog=os.path.join(config_dir, 'WizardMain.bmp'), banner=os.path.join(config_dir, 'WizardBanner.bmp')) - tree = fromstring(xml) + tree = fromstring(xml.encode('utf8')) self._print_verbose('Creating XML fragments from files and directories') fragments = self._get_fragments_from_files(self.dist_path) self._print_verbose('Inserting XML fragments into base WiX file') - wix = base_tree.getroot() + wix = tree.getroot() for fragment in fragments: wix.append(fragment) self._print_verbose('Writing new WiX file') diff --git a/windows/OpenLP-base.wxs b/windows/OpenLP-base.wxs index d56b20d..ffda505 100644 --- a/windows/OpenLP-base.wxs +++ b/windows/OpenLP-base.wxs @@ -21,8 +21,8 @@ Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed - - + +