← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~smpettit/openlp/packaging into lp:openlp

 

Stevan Pettit has proposed merging lp:~smpettit/openlp/packaging into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)

For more details, see:
https://code.launchpad.net/~smpettit/openlp/packaging/+merge/60909

windows-builder.py - Changes to support the documentation trunk and produce the Windows help file from it.  Builder is given a warning if the documentation trunk is not found.

OpenLP-2.0.iss - Changed to NOT create a program menu item for help, if the help file is missing from the build
-- 
https://code.launchpad.net/~smpettit/openlp/packaging/+merge/60909
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'resources/windows/OpenLP-2.0.iss'
--- resources/windows/OpenLP-2.0.iss	2011-05-10 04:25:15 +0000
+++ resources/windows/OpenLP-2.0.iss	2011-05-13 12:25:54 +0000
@@ -69,7 +69,7 @@
 [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

=== modified file 'scripts/windows-builder.py'
--- scripts/windows-builder.py	2011-05-05 13:13:12 +0000
+++ scripts/windows-builder.py	2011-05-13 12:25:54 +0000
@@ -53,7 +53,8 @@
     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 @@
 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 @@
     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 @@
 
 # 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 @@
         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 @@
                 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_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 @@
         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 @@
             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 @@
     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."
 


Follow ups