Cleanup: add main to the list of tools.
authorCarl Hetherington <cth@carlh.net>
Mon, 15 May 2023 22:57:33 +0000 (00:57 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 16 May 2023 21:33:54 +0000 (23:33 +0200)
platform/windows/wscript

index 007381bef067fff3f968abe5d5ca8a3f8589dd59..074c932eb658c00e80f7d6bac8e506c23da5d594 100644 (file)
@@ -3,6 +3,12 @@ import os
 
 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')
@@ -182,13 +188,12 @@ File "%cdist_deps%/bin/libopenjp2.dll"
 
     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)
@@ -352,9 +357,8 @@ SectionEnd
     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("""
@@ -363,16 +367,14 @@ File "%resources%/dcpomatic2_disk_writer.exe.manifest"
         """, 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)
@@ -381,14 +383,12 @@ File "%resources%/dcpomatic2_disk_writer.exe.manifest"
 
     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)
 
@@ -438,11 +438,10 @@ SectionEnd
 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\\*.*"
@@ -456,11 +455,10 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 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\\*.*"
@@ -473,6 +471,7 @@ DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\U
 
 def build(bld):
     all_tools = [
+        ('main', 'main'),
         ('batch', 'Batch Converter'),
         ('kdm', 'KDM Creator'),
         ('kdm_cli', 'KDM Creator CLI'),