1
0
mirror of https://gitlab.com/openlp/packaging.git synced 2024-12-22 13:02:50 +00:00

Fix up errors in builder

This commit is contained in:
Raoul Snyman 2019-04-10 10:50:00 -07:00
parent 76ded370db
commit f0b3ce65a1
2 changed files with 17 additions and 14 deletions

View File

@ -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')

View File

@ -21,8 +21,8 @@
Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<WixVariable Id="WixUILicenseRtf" Value="gpl-2.0.rtf" />
<WixVariable Id="WixUIDialogBmp" Value="{dialog}" />
<WixVariable Id="WixUIBannerBmp" Value="{banner}" />
<WixVariable Id="WixUIDialogBmp" Value="%(dialog)s" />
<WixVariable Id="WixUIBannerBmp" Value="%(banner)s" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="OpenLP"/>