add pdeploy -O

This commit is contained in:
David Rose 2012-09-13 22:57:53 +00:00
parent 449554465d
commit 74a20d0305
2 changed files with 40 additions and 19 deletions

View File

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

View File

@ -102,6 +102,11 @@ Options:
is licensed under. is licensed under.
Only relevant when generating a graphical installer. 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 -a com.your_company
Short identifier of the author of the application. The default Short identifier of the author of the application. The default
is "org.panda3d", but you will most likely want to change is "org.panda3d", but you will most likely want to change
@ -164,9 +169,10 @@ authorname = ""
authoremail = "" authoremail = ""
iconFiles = [] iconFiles = []
includeRequires = False includeRequires = False
omitDefaultCheckboxes = False
try: 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: except getopt.error, msg:
usage(1, msg or 'Invalid option') usage(1, msg or 'Invalid option')
@ -188,6 +194,8 @@ for opt, arg in opts:
currentPlatform = True currentPlatform = True
elif opt == '-s': elif opt == '-s':
includeRequires = True includeRequires = True
elif opt == '-O':
omitDefaultCheckboxes = True
elif opt == '-l': elif opt == '-l':
licensename = arg.strip() licensename = arg.strip()
elif opt == '-L': elif opt == '-L':
@ -267,6 +275,9 @@ elif deploy_mode == 'installer':
tokens["verify_contents"] = "never" tokens["verify_contents"] = "never"
i = Installer(appFilename, shortname, fullname, version, tokens = tokens) i = Installer(appFilename, shortname, fullname, version, tokens = tokens)
i.includeRequires = includeRequires i.includeRequires = includeRequires
if omitDefaultCheckboxes:
i.offerRun = False
i.offerDesktopShortcut = False
i.licensename = licensename i.licensename = licensename
i.licensefile = licensefile i.licensefile = licensefile
if authorid: if authorid: