def write_installer(tools, bits, dcpomatic_version, debug):
+ def name_with_underscore(name):
+ return '' if name == 'main' else '_%s' % name
+
+ def name_with_space(name):
+ return '' if name == 'main' else ' %s' % name
+
# It would be nice to use exist_ok here but it requires quite a new python
try:
os.makedirs('build/platform/windows')
if debug:
print('File "%resources%/gdb_script"', file=f)
- print('File "%resources%/dcpomatic2_debug.bat"', file=f)
print('File "%mingw%/bin/gdb.exe"', file=f)
print('File "%static_deps%/bin/libtermcap.dll"', file=f)
print('File "%static_deps%/bin/libreadline8.dll"', file=f)
print('File "%static_deps%/bin/libmman.dll"', file=f)
for s, l in tools:
- print('File "%%resources%%/dcpomatic2_%s_debug.bat"' % s, file=f)
+ print('File "%%resources%%/dcpomatic2%s_debug.bat"' % name_with_underscore(s), file=f)
else:
print('File "%binaries%/src/wx/dcpomatic2-wx.dll"', file=f)
print('File "%binaries%/src/lib/dcpomatic2.dll"', file=f)
else:
print('CreateDirectory "$SMPROGRAMS\\DCP-o-matic 2"', file=f)
- print('File "%binaries%/src/tools/dcpomatic2.exe"', file=f)
for s, l in tools:
- print('File "%%binaries%%/src/tools/dcpomatic2_%s.exe"' % s, file=f)
+ print('File "%%binaries%%/src/tools/dcpomatic2%s.exe"' % name_with_underscore(s), file=f)
if [t for t in tools if t[0] == 'disk']:
print("""
""", file=f)
if debug:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat"', file=f)
for s, l in tools:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 %s debug.lnk" "$INSTDIR\\bin\\dcpomatic2_%s_debug.bat" ""' % (l, s), file=f)
+ print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2%s debug.lnk" "$INSTDIR\\bin\\dcpomatic2%s_debug.bat" ""' % (name_with_space(l), name_with_underscore(s)), file=f)
print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "DisplayName" "DCP-o-matic 2 debug (remove only)"', file=f)
print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic 2 debug" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
else:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe"', file=f)
for s, l in tools:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 %s.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
+ print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2%s.lnk" "$INSTDIR\\bin\\dcpomatic2%s.exe"' % (name_with_space(l), name_with_underscore(s)), file=f)
print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "DisplayName" "DCP-o-matic 2 (remove only)"', file=f)
print('WriteRegStr HKLM "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\DCP-o-matic2" "UninstallString" "$INSTDIR\\Uninstall.exe"', file=f)
if debug:
print('Section "DCP-o-matic 2 debug desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat" ""', file=f)
for s, l in tools:
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 %s debug.lnk" "$INSTDIR\\bin\\dcpomatic2_%s_debug.bat" ""' % (l, s), file=f)
+ print('CreateShortCut "$DESKTOP\\DCP-o-matic 2%s debug.lnk" "$INSTDIR\\bin\\dcpomatic2%s_debug.bat" ""' % (name_with_space(l), name_with_underscore(s)), file=f)
else:
print('Section "DCP-o-matic 2 desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""', file=f)
for s, l in tools:
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 %s.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
+ print('CreateShortCut "$DESKTOP\\DCP-o-matic 2%s.lnk" "$INSTDIR\\bin\\dcpomatic2%s.exe"' % (name_with_space(l), name_with_underscore(s)), file=f)
print("SectionEnd", file=f)
Section "Uninstall"
RMDir /r "$INSTDIR\\*.*"
RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
""", file=f)
for s, l in tools:
- print('Delete "$DESKTOP\\DCP-o-matic 2 %s debug.lnk"' % l, file=f)
+ print('Delete "$DESKTOP\\DCP-o-matic 2%s debug.lnk"' % name_with_space(l), file=f)
print("""
Delete "$SMPROGRAMS\\DCP-o-matic 2 debug\\*.*"
Section "Uninstall"
RMDir /r "$INSTDIR\\*.*"
RMDir "$INSTDIR"
-Delete "$DESKTOP\\DCP-o-matic 2.lnk"
""", file=f)
for s, l in tools:
- print('Delete "$DESKTOP\\DCP-o-matic 2 %s.lnk"' % l)
+ print('Delete "$DESKTOP\\DCP-o-matic 2%s.lnk"' % name_with_space(l))
print("""
Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
def build(bld):
all_tools = [
+ ('main', 'main'),
('batch', 'Batch Converter'),
('kdm', 'KDM Creator'),
('kdm_cli', 'KDM Creator CLI'),