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

bzr-revno: 1537
This commit is contained in:
Stevan Pettit 2011-05-13 17:24:56 +01:00 committed by Tim Bentley
commit 7a86be70f3
2 changed files with 30 additions and 10 deletions

View File

@ -69,7 +69,7 @@ Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs
[Icons] [Icons]
Name: {group}\{#AppName}; Filename: {app}\{#AppExeName} Name: {group}\{#AppName}; Filename: {app}\{#AppExeName}
Name: {group}\{#AppName} (Debug); Filename: {app}\{#AppExeName}; Parameters: -l debug 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:ProgramOnTheWeb,{#AppName}}; Filename: {#AppURL}
Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe} Name: {group}\{cm:UninstallProgram,{#AppName}}; Filename: {uninstallexe}
Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon Name: {commondesktop}\{#AppName}; Filename: {app}\{#AppExeName}; Tasks: desktopicon

View File

@ -53,7 +53,8 @@ UPX
add that directory to your PATH environment variable. add that directory to your PATH environment variable.
Sphinx 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 HTML Help Workshop
This is used to create the help file This is used to create the help file
@ -99,6 +100,7 @@ windows-builder.py
import os import os
import sys import sys
from shutil import copy from shutil import copy
from shutil import rmtree
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
python_exe = sys.executable 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') u'sphinx-build.exe')
hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop', hhc_exe = os.path.join(os.getenv(u'PROGRAMFILES'), 'HTML Help Workshop',
u'hhc.exe') 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') u'Microsoft Visual Studio 9.0', u'VC', u'vcpackages', u'vcbuild.exe')
# Base paths # Base paths
script_path = os.path.split(os.path.abspath(__file__))[0] script_path = os.path.split(os.path.abspath(__file__))[0]
branch_path = os.path.abspath(os.path.join(script_path, u'..')) 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', site_packages = os.path.join(os.path.split(python_exe)[0], u'Lib',
u'site-packages') u'site-packages')
@ -125,7 +129,9 @@ i18n_utils = os.path.join(script_path, u'translation_utils.py')
# Paths # Paths
source_path = os.path.join(branch_path, u'openlp') 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') i18n_path = os.path.join(branch_path, u'resources', u'i18n')
winres_path = os.path.join(branch_path, u'resources', u'windows') 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') 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')) os.path.join(dist_path, u'OpenLP.ico'))
copy(os.path.join(winres_path, u'LICENSE.txt'), copy(os.path.join(winres_path, u'LICENSE.txt'),
os.path.join(dist_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(): def update_translations():
print u'Updating translations...' print u'Updating translations...'
@ -253,6 +265,9 @@ def compile_translations():
os.path.join(dist_path, u'i18n', filename)) os.path.join(dist_path, u'i18n', filename))
def run_sphinx(): 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...' print u'Running Sphinx...'
os.chdir(manual_path) os.chdir(manual_path)
sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees', sphinx = Popen((sphinx_exe, u'-b', u'htmlhelp', u'-d', u'build/doctrees',
@ -265,7 +280,7 @@ def run_sphinx():
def run_htmlhelp(): def run_htmlhelp():
print u'Running HTML Help Workshop...' 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) hhc = Popen((hhc_exe, u'OpenLP.chm'), stdout=PIPE)
output, error = hhc.communicate() output, error = hhc.communicate()
code = hhc.wait() code = hhc.wait()
@ -273,9 +288,6 @@ def run_htmlhelp():
print u'Exit code:', code print u'Exit code:', code
print output print output
raise Exception(u'Error running HTML Help Workshop') 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(): def run_innosetup():
print u'Running Inno Setup...' print u'Running Inno Setup...'
@ -306,6 +318,8 @@ def main():
print "Source path:", source_path print "Source path:", source_path
print "\"dist\" path:", dist_path print "\"dist\" path:", dist_path
print "PyInstaller:", pyi_build 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 "Inno Setup path:", innosetup_exe
print "Windows resources:", winres_path print "Windows resources:", winres_path
print "VCBuild path:", vcbuild_exe print "VCBuild path:", vcbuild_exe
@ -324,11 +338,17 @@ def main():
write_version_file() write_version_file()
copy_enchant() copy_enchant()
copy_plugins() 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() copy_windows_files()
update_translations() update_translations()
compile_translations() compile_translations()
run_sphinx()
run_htmlhelp()
run_innosetup() run_innosetup()
print "Done." print "Done."