Browse Source

add pdeploy -O

David Rose 13 years ago
parent
commit
74a20d0305
2 changed files with 40 additions and 19 deletions
  1. 28 18
      direct/src/p3d/DeploymentTools.py
  2. 12 1
      direct/src/p3d/pdeploy.py

+ 28 - 18
direct/src/p3d/DeploymentTools.py

@@ -450,6 +450,8 @@ class Installer:
         self.fullname = fullname
         self.version = str(version)
         self.includeRequires = False
+        self.offerRun = True
+        self.offerDesktopShortcut = True
         self.licensename = ""
         self.licensefile = Filename()
         self.authorid = "org.panda3d"
@@ -1091,26 +1093,34 @@ class Installer:
 
         # Tell Vista that we require admin rights
         print >>nsi, 'RequestExecutionLevel admin'
-        print >>nsi
-        print >>nsi, 'Function launch'
-        print >>nsi, '  ExecShell "open" "$INSTDIR\\%s.exe"' % self.shortname
-        print >>nsi, 'FunctionEnd'
-        print >>nsi
-        print >>nsi, 'Function desktopshortcut'
-        if icofile is None:
-            print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe"' % (self.fullname, self.shortname)
-        else:
-            print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe" "" "$INSTDIR\\%s.ico"' % (self.fullname, self.shortname, self.shortname)
-        print >>nsi, 'FunctionEnd'
-        print >>nsi
+        print >>nsi 
+        if self.offerRun:
+            print >>nsi, 'Function launch'
+            print >>nsi, '  ExecShell "open" "$INSTDIR\\%s.exe"' % self.shortname
+            print >>nsi, 'FunctionEnd'
+            print >>nsi
+
+        if self.offerDesktopShortcut:
+            print >>nsi, 'Function desktopshortcut'
+            if icofile is None:
+                print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe"' % (self.fullname, self.shortname)
+            else:
+                print >>nsi, '  CreateShortcut "$DESKTOP\\%s.lnk" "$INSTDIR\\%s.exe" "" "$INSTDIR\\%s.ico"' % (self.fullname, self.shortname, self.shortname)
+            print >>nsi, 'FunctionEnd'
+            print >>nsi
+            
         print >>nsi, '!include "MUI2.nsh"'
         print >>nsi, '!define MUI_ABORTWARNING'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN_FUNCTION launch'
-        print >>nsi, '!define MUI_FINISHPAGE_RUN_TEXT "Run %s"' % self.fullname
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME ""'
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"'
-        print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_FUNCTION desktopshortcut'
+        if self.offerRun:
+            print >>nsi, '!define MUI_FINISHPAGE_RUN'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_NOTCHECKED'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_FUNCTION launch'
+            print >>nsi, '!define MUI_FINISHPAGE_RUN_TEXT "Run %s"' % self.fullname
+        if self.offerDesktopShortcut:
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME ""'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"'
+            print >>nsi, '!define MUI_FINISHPAGE_SHOWREADME_FUNCTION desktopshortcut'
         print >>nsi
         print >>nsi, 'Var StartMenuFolder'
         print >>nsi, '!insertmacro MUI_PAGE_WELCOME'

+ 12 - 1
direct/src/p3d/pdeploy.py

@@ -102,6 +102,11 @@ Options:
      is licensed under.
      Only relevant when generating a graphical installer.
 
+  -O 
+     Specify this option when generating a graphical installer to omit
+     the default checkboxes for "run this program" and "install a
+     desktop shortcut" on completion.
+
   -a com.your_company
      Short identifier of the author of the application. The default
      is "org.panda3d", but you will most likely want to change
@@ -164,9 +169,10 @@ authorname = ""
 authoremail = ""
 iconFiles = []
 includeRequires = False
+omitDefaultCheckboxes = False
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:csl:L:a:A:e:i:h')
+    opts, args = getopt.getopt(sys.argv[1:], 'n:N:v:o:t:P:csOl:L:a:A:e:i:h')
 except getopt.error, msg:
     usage(1, msg or 'Invalid option')
 
@@ -188,6 +194,8 @@ for opt, arg in opts:
         currentPlatform = True
     elif opt == '-s':
         includeRequires = True
+    elif opt == '-O':
+        omitDefaultCheckboxes = True
     elif opt == '-l':
         licensename = arg.strip()
     elif opt == '-L':
@@ -267,6 +275,9 @@ elif deploy_mode == 'installer':
         tokens["verify_contents"] = "never"
     i = Installer(appFilename, shortname, fullname, version, tokens = tokens)
     i.includeRequires = includeRequires
+    if omitDefaultCheckboxes:
+        i.offerRun = False
+        i.offerDesktopShortcut = False
     i.licensename = licensename
     i.licensefile = licensefile
     if authorid: