import os
def write_installer(bits, dcpomatic_version, debug, variant, disk):
- try:
- os.makedirs('build/platform/windows')
- except:
- pass
+
+ tools = [
+ ('batch', 'Batch Converter'),
+ ('kdm', 'KDM Creator'),
+ ('kdm_cli', 'KDM Creator CLI'),
+ ('player', 'Player'),
+ ('cli', 'CLI'),
+ ('create', 'Creator'),
+ ('playlist', 'Playlist Editor')
+ ]
+
+ if disk:
+ tools.append(('disk', 'Disk Writer'))
+
+ os.makedirs('build/platform/windows', exist_ok=True)
filename = 'build/platform/windows/installer.%d.nsi' % bits
if debug:
print('File "%resources%/gdb_script"', file=f)
print('File "%resources%/dcpomatic2_debug.bat"', file=f)
- print('File "%resources%/dcpomatic2_batch_debug.bat"', file=f)
- print('File "%resources%/dcpomatic2_kdm_debug.bat"', file=f)
- print('File "%resources%/dcpomatic2_player_debug.bat"', file=f)
- if disk:
- print('File "%resources%/dcpomatic2_disk_debug.bat"', file=f)
print('File "%mingw%/bin/gdb.exe"', file=f)
+ for s, l in tools:
+ print('File "%%resources%%/dcpomatic2_%s_debug.bat"' % 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 "%binaries%/src/tools/dcpomatic2_batch.exe"
-File "%binaries%/src/tools/dcpomatic2_cli.exe"
-File "%binaries%/src/tools/dcpomatic2_create.exe"
-File "%binaries%/src/tools/dcpomatic2_kdm.exe"
-File "%binaries%/src/tools/dcpomatic2_kdm_cli.exe"
- """, 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)
if disk:
print("""
-File "%binaries%/src/tools/dcpomatic2_disk.exe"
File "%binaries%/src/tools/dcpomatic2_disk_writer.exe"
File "%resources%/dcpomatic2_disk_writer.exe.manifest"
""", file=f)
- print("""
-File "%binaries%/src/tools/dcpomatic2_player.exe"
-File "%binaries%/src/tools/dcpomatic2_playlist.exe"
- """, 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)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Batch Converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 KDM Creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
- if disk:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Disk Writer debug.lnk" "$INSTDIR\\bin\\dcpomatic2_disk_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\\Uninstall DCP-o-matic 2 debug.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2 debug\\DCP-o-matic 2 Player debug.lnk" "$INSTDIR\\bin\\dcpomatic2_player_debug.bat" ""', 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)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Batch Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 KDM Creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
- if disk:
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Disk Writer.lnk" "$INSTDIR\\bin\\dcpomatic2_disk.exe"', file=f)
+ for s, l in tools:
+ print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 %s Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_%s.exe"' % (l, s), file=f)
print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\Uninstall DCP-o-matic 2.lnk" "$INSTDIR\\Uninstall.exe"', file=f)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
- print('CreateShortCut "$SMPROGRAMS\\DCP-o-matic 2\\DCP-o-matic 2 Playlist Editor.lnk" "$INSTDIR\\bin\\dcpomatic2_playlist.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 Player debug.lnk" "$INSTDIR\\bin\\dcpomatic2_player_debug.bat" ""', file=f)
print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 debug.lnk" "$INSTDIR\\bin\\dcpomatic2_debug.bat" ""', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Batch Converter debug.lnk" "$INSTDIR\\bin\\dcpomatic2_batch_debug.bat" ""', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM Creator debug.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm_debug.bat" ""', file=f)
- if disk:
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Disk Writer debug.lnk" "$INSTDIR\\bin\\dcpomatic2_disk_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)
else:
print('Section "DCP-o-matic 2 desktop shortcuts" SEC_MASTER_DESKTOP', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Player.lnk" "$INSTDIR\\bin\\dcpomatic2_player.exe"', file=f)
print('CreateShortCut "$DESKTOP\\DCP-o-matic 2.lnk" "$INSTDIR\\bin\\dcpomatic2.exe" ""', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Batch Converter.lnk" "$INSTDIR\\bin\\dcpomatic2_batch.exe"', file=f)
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 KDM Creator.lnk" "$INSTDIR\\bin\\dcpomatic2_kdm.exe"', file=f)
- if disk:
- print('CreateShortCut "$DESKTOP\\DCP-o-matic 2 Disk Writer.lnk" "$INSTDIR\\bin\\dcpomatic2_disk.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("SectionEnd", file=f)
RMDir /r "$INSTDIR\\*.*"
RMDir "$INSTDIR"
Delete "$DESKTOP\\DCP-o-matic 2 debug.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 Batch Converter debug.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 KDM Creator debug.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 Disk Writer debug.lnk"
+ """, file=f)
+
+ for s, l in tools:
+ print('Delete "$DESKTOP\\DCP-o-matic 2 %s debug.lnk"' % l, file=f)
+
+ print("""
Delete "$SMPROGRAMS\\DCP-o-matic 2 debug\\*.*"
RmDir "$SMPROGRAMS\\DCP-o-matic 2 debug"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2 debug"
RMDir /r "$INSTDIR\\*.*"
RMDir "$INSTDIR"
Delete "$DESKTOP\\DCP-o-matic 2.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 Batch Converter.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 Encode Server.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 KDM creator.lnk"
-Delete "$DESKTOP\\DCP-o-matic 2 Disk Writer.lnk"
+ """, file=f)
+
+ for s, l in tools:
+ print('Delete "$DESKTOP\\DCP-o-matic 2 %s.lnk"' % l)
+
+ print("""
Delete "$SMPROGRAMS\\DCP-o-matic 2\\*.*"
RmDir "$SMPROGRAMS\\DCP-o-matic 2"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\DCP-o-matic 2"