diff --git a/builders/windows-builder.py b/builders/windows-builder.py index 574cb8c..7cb1b84 100644 --- a/builders/windows-builder.py +++ b/builders/windows-builder.py @@ -119,7 +119,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 @@ -143,19 +143,22 @@ 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: source = os.path.join(path, fname) if path else fname - file_id = 'file_{source}'.format(source=source.replace('-', '_').replace(os.sep, '_')) + source = source.replace('-', '_').replace(os.sep, '_') + file_id = 'file_{source}'.format(source=source) + component_id = 'cmp_{source}'.format(source=source) 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): @@ -167,13 +170,13 @@ class WindowsBuilder(Builder): self._print_verbose('Reading base WiX 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) 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') @@ -353,8 +356,6 @@ class WindowsBuilder(Builder): copy(self.icon_path, os.path.join(self.dist_path, 'OpenLP.ico')) self._print_verbose('... LICENSE.txt') copy(self.license_path, os.path.join(self.dist_path, 'LICENSE.txt')) - self._print_verbose('... psvince.dll') - copy(self.psvince_exe, os.path.join(self.dist_path, 'psvince.dll')) if os.path.isfile(os.path.join(self.helpfile_path, 'OpenLP.chm')): self._print_verbose('... OpenLP.chm') copy(os.path.join(self.helpfile_path, 'OpenLP.chm'), os.path.join(self.dist_path, 'OpenLP.chm')) 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 - - + + diff --git a/windows/OpenLP.iss.default b/windows/OpenLP.iss.default deleted file mode 100644 index 0543626..0000000 --- a/windows/OpenLP.iss.default +++ /dev/null @@ -1,187 +0,0 @@ -; Script generated by the Inno Setup Script Wizard. -; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! - -#define AppName "OpenLP" -#define AppVerName "OpenLP %(display_version)s" -#define AppVersion "%(display_version)s" -#define AppPublisher "OpenLP Developers" -#define AppURL "http://openlp.org/" -#define AppExeName "OpenLP.exe" -#define Arch "%(arch)s" - -#define FileHandle FileOpen("%(branch)s\dist\OpenLP\.version") -#define FileLine FileRead(FileHandle) -#define RealVersion FileLine -#expr FileClose(FileHandle) - -[Setup] -; NOTE: The value of AppId uniquely identifies this application. -; Do not use the same AppId value in installers for other applications. -; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppID={{AA7699FA-B2D2-43F4-8A70-D497D03C9485} -AppName={#AppName} -AppVerName={cm:NameAndVersion,{#AppName},{#AppVersion}} -AppVersion={#AppVersion} -AppPublisher={#AppPublisher} -AppPublisherURL={#AppURL} -AppSupportURL={#AppURL} -AppUpdatesURL={#AppURL} -DefaultDirName={pf}\{#AppName} -DefaultGroupName={#AppName} -AllowNoIcons=true -LicenseFile=LICENSE.txt -OutputDir=%(branch)s\dist\ -OutputBaseFilename=OpenLP-{#RealVersion}-{#Arch}-setup -Compression=lzma/Max -SolidCompression=true -SetupIconFile=OpenLP.ico -VersionInfoVersion={#AppVersion} -WizardImageFile=WizImageBig.bmp -WizardSmallImageFile=WizImageSmall.bmp -ChangesAssociations=true - -[Languages] -Name: english; MessagesFile: compiler:Default.isl -Name: brazilianportuguese; MessagesFile: compiler:Languages\BrazilianPortuguese.isl -Name: catalan; MessagesFile: compiler:Languages\Catalan.isl -Name: czech; MessagesFile: compiler:Languages\Czech.isl -Name: danish; MessagesFile: compiler:Languages\Danish.isl -Name: dutch; MessagesFile: compiler:Languages\Dutch.isl -Name: finnish; MessagesFile: compiler:Languages\Finnish.isl -Name: french; MessagesFile: compiler:Languages\French.isl -Name: german; MessagesFile: compiler:Languages\German.isl -Name: hebrew; MessagesFile: compiler:Languages\Hebrew.isl -Name: hungarian; MessagesFile: compiler:Languages\Hungarian.isl -Name: italian; MessagesFile: compiler:Languages\Italian.isl -Name: japanese; MessagesFile: compiler:Languages\Japanese.isl -Name: norwegian; MessagesFile: compiler:Languages\Norwegian.isl -Name: polish; MessagesFile: compiler:Languages\Polish.isl -Name: portuguese; MessagesFile: compiler:Languages\Portuguese.isl -Name: russian; MessagesFile: compiler:Languages\Russian.isl -Name: slovenian; MessagesFile: compiler:Languages\Slovenian.isl -Name: spanish; MessagesFile: compiler:Languages\Spanish.isl - -[Tasks] -Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons} -Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; OnlyBelowVersion: 0, 6.1 - -[Files] -Source: %(branch)s\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs -; DLL used to check if the target program is running at install time -Source: psvince.dll; flags: dontcopy -; psvince is installed in {app} folder, so it will be loaded at -; uninstall time to check if the target program is running -Source: psvince.dll; DestDir: {app} - -[Icons] -Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} -Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug -Name: {group}\{#AppName} Help; Filename: {app}\{#AppName}.chm; Check: FileExists(ExpandConstant('{app}\{#AppName}.chm')) -Name: {group}\{cm:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL} -Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe} -Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon -Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: quicklaunchicon - -[Run] -Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent - -[Registry] -Root: HKCR; Subkey: .osz; ValueType: string; ValueName: ; ValueData: OpenLP; Flags: uninsdeletevalue -Root: HKCR; Subkey: .oszl; ValueType: string; ValueName: ; ValueData: OpenLP; Flags: uninsdeletevalue -Root: HKCR; Subkey: OpenLP; ValueType: string; ValueName: ; ValueData: OpenLP Service; Flags: uninsdeletekey -Root: HKCR; Subkey: OpenLP\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\OpenLP.exe,0 -Root: HKCR; Subkey: OpenLP\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\OpenLP.exe"" ""%1""" - -[UninstallDelete] -; Remove support directory created when program is run: -Type: filesandordirs; Name: {app}\support -; Remove program directory if empty: -Name: {app}; Type: dirifempty - -[Code] -// Function to call psvince.dll at install time -function IsModuleLoadedInstall(modulename: AnsiString ): Boolean; -external 'IsModuleLoaded@files:psvince.dll stdcall setuponly'; - -// Function to call psvince.dll at uninstall time -function IsModuleLoadedUninstall(modulename: AnsiString ): Boolean; -external 'IsModuleLoaded@{app}\psvince.dll stdcall uninstallonly' ; - -function GetUninstallString(): String; -var - sUnInstPath: String; - sUnInstallString: String; -begin - sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1'); - sUnInstallString := ''; - if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then - RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString); - Result := sUnInstallString; -end; - -function IsUpgrade(): Boolean; -begin - Result := (GetUninstallString() <> ''); -end; - -// Return Values: -// 1 - uninstall string is empty -// 2 - error executing the UnInstallString -// 3 - successfully executed the UnInstallString -function UnInstallOldVersion(): Integer; -var - sUnInstallString: String; - iResultCode: Integer; -begin - Result := 0; - sUnInstallString := GetUninstallString(); - if sUnInstallString <> '' then - begin - sUnInstallString := RemoveQuotes(sUnInstallString); - if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then - Result := 3 - else - Result := 2; - end - else - Result := 1; -end; - -function InitializeSetup(): Boolean; -begin - Result := true; - while IsModuleLoadedInstall( 'OpenLP.exe' ) and Result do - begin - if MsgBox( 'Openlp is currently running, please close it to continue the install.', - mbError, MB_OKCANCEL ) = IDCANCEL then - begin - Result := false; - end; - end; -end; - -procedure CurStepChanged(CurStep: TSetupStep); -begin - if (CurStep=ssInstall) then - begin - if (IsUpgrade()) then - begin - UnInstallOldVersion(); - end; - end; -end; - -function InitializeUninstall(): Boolean; -begin - Result := true; - while IsModuleLoadedUninstall( 'OpenLP.exe' ) and Result do - begin - if MsgBox( 'Openlp is currently running, please close it to continue the uninstall.', - mbError, MB_OKCANCEL ) = IDCANCEL then - begin - Result := false; - end; - end; -// Unload psvince.dll, otherwise it is not deleted - UnloadDLL(ExpandConstant('{app}\psvince.dll')); -end; diff --git a/windows/config-appveyor.ini b/windows/config-appveyor.ini index 3062bd2..85e4e73 100644 --- a/windows/config-appveyor.ini +++ b/windows/config-appveyor.ini @@ -2,7 +2,6 @@ sphinx = %(pyroot)s\Scripts\sphinx-build.exe pyinstaller = %(pyroot)s\Scripts\pyinstaller-script.py htmlhelp = %(progfiles)s\HTML Help Workshop\hhc.exe -psvince = %(here)s\psvince.dll lrelease = C:\Qt\5.12\msvc2017\bin\lrelease.exe portablelauncher = %(here)s\..\..\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe portableinstaller = %(here)s\..\..\PortableApps.comInstaller\PortableApps.comInstaller.exe diff --git a/windows/config.ini.default b/windows/config.ini.default index 7b67dc3..22a9804 100644 --- a/windows/config.ini.default +++ b/windows/config.ini.default @@ -1,9 +1,7 @@ [executables] -innosetup = %(progfiles)s\Inno Setup 5\ISCC.exe sphinx = %(pyroot)s\Scripts\sphinx-build.exe pyinstaller = %(here)s\..\pyinstaller\pyinstaller.py htmlhelp = %(progfiles)s\HTML Help Workshop\hhc.exe -psvince = %(here)s\psvince.dll lrelease = %(sitepackages)s\PyQt5\bin\lrelease.exe portablelauncher = %(progfiles)s\PortableApps.comLauncher\PortableApps.comLauncherGenerator.exe portableinstaller = %(progfiles)s\PortableApps.comInstaller\PortableApps.comInstaller.exe diff --git a/windows/psvince.dll b/windows/psvince.dll deleted file mode 100644 index e910509..0000000 Binary files a/windows/psvince.dll and /dev/null differ