From a8f2cd2e1f76240aac70bcbe20a0465367aa2d9c Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 4 May 2010 22:19:40 +0100 Subject: [PATCH 1/7] Import fixes --- openlp/plugins/remotes/remoteplugin.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index 2c632d90d..bc1679fc9 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -25,9 +25,7 @@ import logging -from PyQt4 import QtNetwork, QtCore - -from openlp.core.lib import Plugin, Receiver +from openlp.core.lib import Plugin from openlp.plugins.remotes.lib import RemoteTab, HttpServer log = logging.getLogger(__name__) From c8b6a3640d9de90ca1001e63234220c95e491240 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 20 May 2010 17:49:47 +0100 Subject: [PATCH 2/7] Import fixes --- openlp/plugins/songs/forms/songimportform.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 3049ed6c5..ff6b416c6 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -23,10 +23,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -import csv import logging -import os -import os.path from PyQt4 import QtCore, QtGui From 98cc2d93ecc53520267c93b6654d07d529df6185 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Sun, 23 May 2010 17:49:34 +0200 Subject: [PATCH 3/7] Windows-related fixes: - Update Windows installer file to get version automatically. - Update version file (for Windows) - Update OpenLP.spec for PyInstaller/Windows build. --- OpenLP.spec | 2 +- openlp/.version | 2 +- resources/innosetup/OpenLP-2.0.iss | 63 +++++++++++++++++------------ resources/innosetup/OpenLP.reg | Bin 0 -> 1670 bytes scripts/openlp-1to2-converter.py | 2 +- 5 files changed, 40 insertions(+), 29 deletions(-) create mode 100644 resources/innosetup/OpenLP.reg diff --git a/OpenLP.spec b/OpenLP.spec index 366bdf31d..e4436dea2 100644 --- a/OpenLP.spec +++ b/OpenLP.spec @@ -1,6 +1,6 @@ # -*- mode: python -*- a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'openlp.pyw'], - pathex=['c:\\Documents and Settings\\raoul\\My Documents\\My Projects\\openlp\\pyinstaller']) + pathex=['C:\\Documents and Settings\\raoul\\My Documents\\My Projects\\openlp\\trunk']) pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, diff --git a/openlp/.version b/openlp/.version index f8e233b27..2007f03af 100644 --- a/openlp/.version +++ b/openlp/.version @@ -1 +1 @@ -1.9.0 +1.9.1-bzr821 diff --git a/resources/innosetup/OpenLP-2.0.iss b/resources/innosetup/OpenLP-2.0.iss index b826fa76f..e75f1076f 100644 --- a/resources/innosetup/OpenLP-2.0.iss +++ b/resources/innosetup/OpenLP-2.0.iss @@ -1,28 +1,33 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define MyAppName "OpenLP" -#define MyAppVerName "OpenLP 2.0" -#define MyAppPublisher "OpenLP Developers" -#define MyAppURL "http://openlp.org/" -#define MyAppExeName "OpenLP.exe" +#define AppName "OpenLP" +#define AppVerName "OpenLP 2.0" +#define AppPublisher "OpenLP Developers" +#define AppURL "http://openlp.org/" +#define AppExeName "OpenLP.exe" + +#define FileHandle FileOpen("..\..\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={#MyAppName} -AppVerName={#MyAppVerName} -AppPublisher={#MyAppPublisher} -AppPublisherURL={#MyAppURL} -AppSupportURL={#MyAppURL} -AppUpdatesURL={#MyAppURL} -DefaultDirName={pf}\{#MyAppName} -DefaultGroupName=OpenLP 2.0 +AppName={#AppName} +AppVerName={#AppVerName} +AppPublisher={#AppPublisher} +AppPublisherURL={#AppURL} +AppSupportURL={#AppURL} +AppUpdatesURL={#AppURL} +DefaultDirName={pf}\{#AppName} +DefaultGroupName={#AppVerName} AllowNoIcons=true LicenseFile=LICENSE.txt -OutputBaseFilename=OpenLP-1.9.0-bzr739-setup +OutputBaseFilename=OpenLP-{#RealVersion}-setup Compression=lzma SolidCompression=true SetupIconFile=C:\Program Files\Inno Setup 5\Examples\Setup.ico @@ -57,20 +62,26 @@ Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:Ad Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons} [Files] -Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion -Source: ..\..\dist\OpenLP\plugins\*; DestDir: {app}\plugins; Flags: ignoreversion recursesubdirs createallsubdirs -Source: ..\..\dist\OpenLP\Microsoft.VC90.CRT\*; DestDir: {app}\Microsoft.VC90.CRT; Flags: ignoreversion recursesubdirs createallsubdirs -Source: ..\..\dist\OpenLP\qt4_plugins\*; DestDir: {app}\qt4_plugins; Flags: ignoreversion recursesubdirs createallsubdirs -Source: ..\..\dist\OpenLP\eggs\*; DestDir: {app}\eggs; Flags: ignoreversion recursesubdirs createallsubdirs -Source: openlp.conf; DestDir: {userappdata}\openlp; Flags: ignoreversion onlyifdoesntexist +Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] -Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName} -Name: {group}\{cm:ProgramOnTheWeb,{#MyAppName}}; Filename: {#MyAppURL} -Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe} -Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon -Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: quicklaunchicon +Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} +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}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent +Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent + +[Registry] +Root: HKCU; SubKey: Software\OpenLP\OpenLP\alerts; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\bibles; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\custom; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\images; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\media; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\presentations; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\remotes; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\songs; ValueType: dword; ValueName: status; ValueData: $00000001 +Root: HKCU; SubKey: Software\OpenLP\OpenLP\songusage; ValueType: dword; ValueName: status; ValueData: $00000001 diff --git a/resources/innosetup/OpenLP.reg b/resources/innosetup/OpenLP.reg new file mode 100644 index 0000000000000000000000000000000000000000..503e718a201e3cfc34aad41d9a43f173fa11776d GIT binary patch literal 1670 zcmd6n-D<)>5QV?%g6|+cfY^)P2)!zTV5yR7MNE;XsRT?SW=rVH*Pfl|3lx=Q3A<;8 z3}?>#oPOtI6l^J}sb~|CvXiaCapXsqfxMYeDct5m{-eB^a3TCem!3|G2m6)`8R?$| zD_)o>UL^F!RCva_-Vw3xk}t)qNfa%WWz0c$!7CF!uNv)sv14VkH+`HGYO?5z8|EFeR?XJNFFbA=Q^)sM9-MBOI3=2iG{BnXV&$hZ2~M?x q&2?on?ZnTWH%559=l4&p&T~OlxDvBM-4~v27iNC1HS_V`jrRxQr4Dca literal 0 HcmV?d00001 diff --git a/scripts/openlp-1to2-converter.py b/scripts/openlp-1to2-converter.py index 8645fc2a4..f0c5a0975 100755 --- a/scripts/openlp-1to2-converter.py +++ b/scripts/openlp-1to2-converter.py @@ -97,7 +97,7 @@ create_statements = [ ] def prepare_string(dirty): - return dirty_chars.sub(u'', dirty.replace(u'\r\n', ' ').replace(u'\n', ' ')) + return dirty_chars.sub(u'', dirty.replace(u'\r\n', u' ').replace(u'\n', u' ')) def display_sql(sql, params): prepared_params = [] From 4351ae5ecbe40b0235527dfb75da0b7650af6ffd Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 24 May 2010 22:46:45 +0200 Subject: [PATCH 4/7] Added a build script. --- OpenLP.spec | 2 +- resources/pyinstaller/windows-copy-plugins.py | 130 ++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 resources/pyinstaller/windows-copy-plugins.py diff --git a/OpenLP.spec b/OpenLP.spec index e4436dea2..9569af6c1 100644 --- a/OpenLP.spec +++ b/OpenLP.spec @@ -1,6 +1,6 @@ # -*- mode: python -*- a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'openlp.pyw'], - pathex=['C:\\Documents and Settings\\raoul\\My Documents\\My Projects\\openlp\\trunk']) + pathex=[os.path.abspath('.')]) pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, diff --git a/resources/pyinstaller/windows-copy-plugins.py b/resources/pyinstaller/windows-copy-plugins.py new file mode 100644 index 000000000..42592768a --- /dev/null +++ b/resources/pyinstaller/windows-copy-plugins.py @@ -0,0 +1,130 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2010 Raoul Snyman # +# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # +# Thompson, Jon Tibble, Carsten Tinggaard # +# --------------------------------------------------------------------------- # +# 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 # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +""" +Windows Build Script +-------------------- + +This script is used to build the Windows binary and the accompanying installer. + +For this script to work out of the box, it depends on being inside the +"resources/pyinstaller" directory in the OpenLP source tree, it depends on +OpenLP having it's own project directory which all the branches live in, and it +depends on PyInstaller being +""" + +import os +from shutil import copy +from subprocess import Popen, PIPE + +script_path = os.path.split(os.path.abspath(__file__))[0] +pyinstaller_path = os.path.abspath(os.path.join(script_path, u'..', u'..', u'..', u'..', u'pyinstaller')) +innosetup_path = os.path.join(os.getenv(u'PROGRAMFILES'), 'Inno Setup 5') +iss_path = os.path.abspath(os.path.join(script_path, u'..', u'innosetup')) +branch_path = os.path.abspath(os.path.join(script_path, u'..', u'..')) +source_path = os.path.join(branch_path, u'openlp') +dist_path = os.path.join(branch_path, u'dist', u'OpenLP') + + +def run_pyinstaller(): + print u'Running PyInstaller...' + os.chdir(branch_path) + pyinstaller = Popen((u'python', os.path.join(pyinstaller_path, u'Build.py'), + u'OpenLP.spec')) + code = pyinstaller.wait() + if code != 0: + raise Exception(u'Error running PyInstaller Build.py') + +def write_version_file(): + print u'Writing version file...' + os.chdir(branch_path) + bzr = Popen((u'bzr', u'tags', u'--sort', u'time'), stdout=PIPE) + output, error = bzr.communicate() + code = bzr.wait() + if code != 0: + raise Exception(u'Error running bzr tags') + lines = output.splitlines() + if len(lines) == 0: + tag = u'0.0.0' + revision = u'0' + else: + tag, revision = lines[-1].split() + bzr = Popen((u'bzr', u'log', u'--line', u'-r', u'-1'), stdout=PIPE) + output, error = bzr.communicate() + code = bzr.wait() + if code != 0: + raise Exception(u'Error running bzr log') + latest = output.split(u':')[0] + versionstring = latest == revision and tag or u'%s-bzr%s' % (tag, latest) + f = open(os.path.join(dist_path, u'.version'), u'w') + f.write(versionstring) + f.close() + +def copy_plugins(): + print u'Copying plugins...' + source = os.path.join(source_path, u'plugins') + dest = os.path.join(dist_path, u'plugins') + for root, dirs, files in os.walk(source): + for filename in files: + if not filename.endswith(u'.pyc'): + dest_path = os.path.join(dest, root[len(source)+1:]) + if not os.path.exists(dest_path): + os.makedirs(dest_path) + copy(os.path.join(root, filename), + os.path.join(dest_path, filename)) + +def copy_windows_files(): + print u'Copying extra files for Windows...' + copy(os.path.join(iss_path, u'OpenLP.ico'), os.path.join(dist_path, u'OpenLP.ico')) + copy(os.path.join(iss_path, u'LICENSE.txt'), os.path.join(dist_path, u'LICENSE.txt')) + +def run_innosetup(): + print u'Running Inno Setup...' + os.chdir(iss_path) + run_command = u'"%s" "%s"' % (os.path.join(innosetup_path, u'ISCC.exe'), + os.path.join(iss_path, u'OpenLP-2.0.iss')) + print run_command + innosetup = Popen(run_command) + code = innosetup.wait() + if code != 0: + raise Exception(u'Error running Inno Setup') + +def main(): + print "Script path:", script_path + print "PyInstaller path:", pyinstaller_path + print "Inno Setup path:", innosetup_path + print "ISS file path:", iss_path + print "Branch path:", branch_path + print "Source path:", source_path + print "\"dist\" path:", dist_path + run_pyinstaller() + write_version_file() + copy_plugins() + copy_windows_files() + run_innosetup() + print "Done." + +if __name__ == u'__main__': + main() From cd00c192b459fd111497addc4a4e930624bdcca9 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 24 May 2010 22:53:56 +0200 Subject: [PATCH 5/7] Rename builder script to a better name. --- .../pyinstaller/{windows-copy-plugins.py => windows-builder.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename resources/pyinstaller/{windows-copy-plugins.py => windows-builder.py} (100%) diff --git a/resources/pyinstaller/windows-copy-plugins.py b/resources/pyinstaller/windows-builder.py similarity index 100% rename from resources/pyinstaller/windows-copy-plugins.py rename to resources/pyinstaller/windows-builder.py From 6b1a6a0638ff0e514adc341087273ec345a7cbbd Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 25 May 2010 19:12:21 +0200 Subject: [PATCH 6/7] More intelligent version checking. --- openlp/core/ui/mainwindow.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 92c8fed94..a4c683504 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -25,6 +25,7 @@ import logging import time +import re from PyQt4 import QtCore, QtGui @@ -60,6 +61,7 @@ class VersionThread(QtCore.QThread): QtCore.QThread.__init__(self, parent) self.parent = parent self.app_version = app_version + self.version_splitter = re.compile(r'([0-9]+).([0-9]+).([0-9]+)(?:-bzr([0-9]+))') def run(self): """ @@ -68,8 +70,29 @@ class VersionThread(QtCore.QThread): time.sleep(1) Receiver.send_message(u'maindisplay_blank_check') version = check_latest_version(self.app_version) - #new version has arrived - if version != self.app_version[u'full']: + remote_version = {} + local_version = {} + match = self.version_splitter.match(version) + if match: + remote_version[u'major'] = int(match.group(1)) + remote_version[u'minor'] = int(match.group(2)) + remote_version[u'release'] = int(match.group(3)) + if len(match.groups()) > 3: + remote_version[u'revision'] = int(match.group(4)) + match = self.version_splitter.match(self.app_version[u'full']) + if match: + local_version[u'major'] = int(match.group(1)) + local_version[u'minor'] = int(match.group(2)) + local_version[u'release'] = int(match.group(3)) + if len(match.groups()) > 3: + local_version[u'revision'] = int(match.group(4)) + if remote_version[u'major'] > local_version[u'major'] or \ + remote_version[u'minor'] > local_version[u'minor'] or \ + remote_version[u'release'] > local_version[u'release']: + Receiver.send_message(u'openlp_version_check', u'%s' % version) + elif remote_version.get(u'revision') and \ + local_version.get(u'revision') and \ + remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) class Ui_MainWindow(object): From 5b39ab942acf724bd9f596f7105989ff893527b6 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 25 May 2010 20:55:02 +0200 Subject: [PATCH 7/7] Indented everything to 4 spaces, as per Jon's recommendation. --- openlp/core/ui/mainwindow.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a4c683504..48f0f6894 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -87,12 +87,12 @@ class VersionThread(QtCore.QThread): if len(match.groups()) > 3: local_version[u'revision'] = int(match.group(4)) if remote_version[u'major'] > local_version[u'major'] or \ - remote_version[u'minor'] > local_version[u'minor'] or \ - remote_version[u'release'] > local_version[u'release']: + remote_version[u'minor'] > local_version[u'minor'] or \ + remote_version[u'release'] > local_version[u'release']: Receiver.send_message(u'openlp_version_check', u'%s' % version) elif remote_version.get(u'revision') and \ - local_version.get(u'revision') and \ - remote_version[u'revision'] > local_version[u'revision']: + local_version.get(u'revision') and \ + remote_version[u'revision'] > local_version[u'revision']: Receiver.send_message(u'openlp_version_check', u'%s' % version) class Ui_MainWindow(object):