diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index 8cc8a4aa7..9f193b0e8 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -69,7 +69,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs [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 +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 diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 0271f80b8..27798a850 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -53,7 +53,8 @@ UPX add that directory to your PATH environment variable. Sphinx - This is used to build the documentation + This is used to build the documentation. The documentation trunk must be at + the same directory level as Openlp trunk and named "documentation" HTML Help Workshop This is used to create the help file @@ -99,6 +100,7 @@ windows-builder.py import os import sys from shutil import copy +from shutil import rmtree from subprocess import Popen, PIPE python_exe = sys.executable @@ -108,12 +110,14 @@ sphinx_exe = os.path.join(os.path.split(python_exe)[0], u'Scripts', u'sphinx-build.exe') hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop', u'hhc.exe') -vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'), +vcbuild_exe = os.path.join(os.getenv(u'PROGRAMFILES'), u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe') # Base paths script_path = os.path.split(os.path.abspath(__file__))[0] branch_path = os.path.abspath(os.path.join(script_path, u'..')) +doc_branch_path = os.path.abspath(os.path.join(script_path, u'..', + u'..',u'documentation')) site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib', u'site-packages') @@ -125,7 +129,9 @@ i18n_utils = os.path.join(script_path, u'translation_utils.py') # Paths source_path = os.path.join(branch_path, u'openlp') -manual_path = os.path.join(branch_path, u'documentation', u'manual') +manual_path = os.path.join(doc_branch_path, u'manual') +manual_build_path = os.path.join(manual_path, u'build') +helpfile_path = os.path.join(manual_build_path, u'htmlhelp') i18n_path = os.path.join(branch_path, u'resources', u'i18n') winres_path = os.path.join(branch_path, u'resources', u'windows') build_path = os.path.join(branch_path, u'build', u'pyi.win32', u'OpenLP') @@ -219,6 +225,12 @@ def copy_windows_files(): os.path.join(dist_path, u'OpenLP.ico')) copy(os.path.join(winres_path, u'LICENSE.txt'), os.path.join(dist_path, u'LICENSE.txt')) + if os.path.isfile(os.path.join(helpfile_path, u'Openlp.chm')): + print u' Windows help file found' + copy(os.path.join(helpfile_path,u'Openlp.chm'), + os.path.join(dist_path, u'Openlp.chm')) + else: + print u' WARNING ---- Windows help file not found ---- WARNING' def update_translations(): print u'Updating translations...' @@ -253,6 +265,9 @@ def compile_translations(): os.path.join(dist_path, u'i18n', filename)) def run_sphinx(): + print u'Deleting previous manual build...',manual_build_path + if os.path.exists(manual_build_path): + rmtree(manual_build_path) print u'Running Sphinx...' os.chdir(manual_path) sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees', @@ -265,7 +280,7 @@ def run_sphinx(): def run_htmlhelp(): print u'Running HTML Help Workshop...' - os.chdir(os.path.join(manual_path, u'build', u'htmlhelp')) + os.chdir(os.path.join(manual_build_path, u'htmlhelp')) hhc = Popen((hhc_exe, u'OpenLP.chm'), stdout=PIPE) output, error = hhc.communicate() code = hhc.wait() @@ -273,9 +288,6 @@ def run_htmlhelp(): print u'Exit code:', code print output raise Exception(u'Error running HTML Help Workshop') - else: - copy(os.path.join(manual_path, u'build', 'htmlhelp', u'OpenLP.chm'), - os.path.join(dist_path, u'OpenLP.chm')) def run_innosetup(): print u'Running Inno Setup...' @@ -306,6 +318,8 @@ def main(): print "Source path:", source_path print "\"dist\" path:", dist_path print "PyInstaller:", pyi_build + print "Documentation branch path:", doc_branch_path + print "Help file build path;", helpfile_path print "Inno Setup path:", innosetup_exe print "Windows resources:", winres_path print "VCBuild path:", vcbuild_exe @@ -324,11 +338,17 @@ def main(): write_version_file() copy_enchant() copy_plugins() + if os.path.exists(manual_path): + run_sphinx() + run_htmlhelp() + else: + print u' ' + print u' WARNING ---- Documentation Trunk not found ---- WARNING' + print u' --- Windows Help file will not be included in build ---' + print u' ' copy_windows_files() update_translations() compile_translations() - run_sphinx() - run_htmlhelp() run_innosetup() print "Done."