More Windows install updates contributed by Steve Hall and Stephen George <steve_geo@optusnet.com.au>.

svn: r11206
This commit is contained in:
Brian Matherly 2008-10-28 04:04:15 +00:00
parent 74e9e7daa2
commit 4ef7a9eeeb
2 changed files with 366 additions and 322 deletions

View File

@ -1,6 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2008 Steve Hall
# Copyright (C) 2008 Stephen George # Copyright (C) 2008 Stephen George
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify

View File

@ -1,9 +1,25 @@
# #
# Filename: gramps.nsi # Gramps - a GTK+ based genealogy program
#
# Copyright (C) 2008 Steve Hall [ digitect dancingpaper com ]
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: $
# #
# Description: Nullsoft Installer (NSIS) file to build Windows installer: # Description: Nullsoft Installer (NSIS) file to build Windows installer:
# Updated: 2007-06-18 07:09:38-0400
# Author: Steve Hall [ digitect dancingpaper com ]
# #
# Requires: NSIS version 2.0 or later. # Requires: NSIS version 2.0 or later.
# Notes: # Notes:
@ -43,7 +59,7 @@ CRCCheck on
# compression # compression
SetCompress auto SetCompress auto
# zlib good, bzip2 better, lzma best (and slowest, whew.) # zlib good, bzip2 better, lzma best (and slowest, whew.)
SetCompressor lzma SetCompressor lzma
# reference existing store if possible # reference existing store if possible
SetDatablockOptimize on SetDatablockOptimize on
@ -134,8 +150,47 @@ SilentInstall normal
# 4. Custom functions {{{1 # 4. Custom functions {{{1
# 5. Language files {{{1 # 5. Language files {{{1
# Languages
# TODO: These are pretty badly broken at the moment.
# Note: This appears to be due to building on Win95 which does not
# support Unicode:
# (http://nsis.sf.net/archive/nsisweb.php?page=247&instances=0,235)
#
# So what happens if we use only ASCII?
#
#!insertmacro MUI_LANGUAGE "Arabic"
#!insertmacro MUI_LANGUAGE "Bulgarian"
#!insertmacro MUI_LANGUAGE "Catalan"
#!insertmacro MUI_LANGUAGE "Croatian"
#!insertmacro MUI_LANGUAGE "Czech"
#!insertmacro MUI_LANGUAGE "Default"
#!insertmacro MUI_LANGUAGE "Estonian"
#!insertmacro MUI_LANGUAGE "Farsi"
#!insertmacro MUI_LANGUAGE "Finnish"
#!insertmacro MUI_LANGUAGE "Greek"
#!insertmacro MUI_LANGUAGE "Hebrew"
#!insertmacro MUI_LANGUAGE "Hungarian"
#!insertmacro MUI_LANGUAGE "Indonesian"
#!insertmacro MUI_LANGUAGE "Japanese"
#!insertmacro MUI_LANGUAGE "Korean"
#!insertmacro MUI_LANGUAGE "Latvian"
#!insertmacro MUI_LANGUAGE "Lithuanian"
#!insertmacro MUI_LANGUAGE "Macedonian"
#!insertmacro MUI_LANGUAGE "Norwegian"
#!insertmacro MUI_LANGUAGE "Polish"
#!insertmacro MUI_LANGUAGE "Romanian"
#!insertmacro MUI_LANGUAGE "Russian"
#!insertmacro MUI_LANGUAGE "Serbian"
#!insertmacro MUI_LANGUAGE "SerbianLatin"
#!insertmacro MUI_LANGUAGE "SimpChinese"
#!insertmacro MUI_LANGUAGE "Slovak"
#!insertmacro MUI_LANGUAGE "Slovenian"
#!insertmacro MUI_LANGUAGE "Swedish"
#!insertmacro MUI_LANGUAGE "Thai"
#!insertmacro MUI_LANGUAGE "TradChinese"
#!insertmacro MUI_LANGUAGE "Turkish"
#!insertmacro MUI_LANGUAGE "Ukrainian"
# Latin1
!insertmacro MUI_LANGUAGE "Danish" !insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Dutch" !insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
@ -146,40 +201,6 @@ SilentInstall normal
!insertmacro MUI_LANGUAGE "PortugueseBR" !insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Spanish" !insertmacro MUI_LANGUAGE "Spanish"
# non-Latin1 below (bugs in NSIS?)
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Czech"
#!insertmacro MUI_LANGUAGE "Default" <= WHAT IS THIS?
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Ukrainian"
# 6. Reserve Files {{{1 # 6. Reserve Files {{{1
# 1}}} # 1}}}
@ -190,11 +211,11 @@ SilentInstall normal
Section "Program files (required)" Main Section "Program files (required)" Main
SectionIn 1 2 3 RO SectionIn 1 2 3 RO
Call WarnDirExists Call WarnDirExists
SetOutPath $INSTDIR SetOutPath $INSTDIR
File /r ..\src\*.* File /r ..\src\*.*
#File /r ..\nsis\gramps.ico #File /r ..\nsis\gramps.ico
SectionEnd SectionEnd
@ -204,19 +225,19 @@ SubSection "Menus and shortcuts" MenusAndIcons
Section "Add GRAMPS to the Start Menu" MenuStart Section "Add GRAMPS to the Start Menu" MenuStart
SectionIn 1 3 SectionIn 1 3
# determines "Start In" location for shortcuts # determines "Start In" location for shortcuts
SetOutPath $INSTDIR SetOutPath $INSTDIR
StrCpy $0 "GRAMPS" StrCpy $0 "GRAMPS"
IfFileExists "$SMPROGRAMS\$0" 0 skipStartMenuRemove IfFileExists "$SMPROGRAMS\$0" 0 skipStartMenuRemove
RMDir /r "$SMPROGRAMS\$0\" RMDir /r "$SMPROGRAMS\$0\"
skipStartMenuRemove: skipStartMenuRemove:
CreateDirectory "$SMPROGRAMS\$0\" CreateDirectory "$SMPROGRAMS\$0\"
CreateShortCut "$SMPROGRAMS\$0\GRAMPS ${GRAMPS_VER_MAJOR}.${GRAMPS_VER_MINOR}.${GRAMPS_VER_POINT}-${GRAMPS_VER_BUILD}.lnk" "$3" "$\"$INSTDIR\gramps.py$\"" "$INSTDIR\images\ped24.ico" "0" "" "" "GRAMPS" CreateShortCut "$SMPROGRAMS\$0\GRAMPS ${GRAMPS_VER_MAJOR}.${GRAMPS_VER_MINOR}.${GRAMPS_VER_POINT}-${GRAMPS_VER_BUILD}.lnk" "$3" "$\"$INSTDIR\gramps.py$\"" "$INSTDIR\images\ped24.ico" "0" "" "" "GRAMPS"
WriteINIStr "$SMPROGRAMS\$0\GRAMPS Website.url" "InternetShortcut" "URL" "http://www.gramps-project.org/" WriteINIStr "$SMPROGRAMS\$0\GRAMPS Website.url" "InternetShortcut" "URL" "http://www.gramps-project.org/"
CreateShortCut "$SMPROGRAMS\$0\Uninstall GRAMPS.lnk" "$\"$INSTDIR\uninstall.exe$\"" "" "" "0" "" "" "Uninstall GRAMPS" CreateShortCut "$SMPROGRAMS\$0\Uninstall GRAMPS.lnk" "$\"$INSTDIR\uninstall.exe$\"" "" "" "0" "" "" "Uninstall GRAMPS"
SectionEnd SectionEnd
@ -232,20 +253,22 @@ SubSectionEnd
# Language Files {{{1 # Language Files {{{1
Section "Language Files" LangFiles Section "Language Files" LangFiles
# off by default
#SectionIn 1 3
#CreateDirectory $INSTDIR\lang #CreateDirectory $INSTDIR\lang
SetOutPath $INSTDIR SetOutPath $INSTDIR
File /r ..\po\*.mo File /r ..\po\*.mo
#MessageBox MB_OK "Setting up languages..." #MessageBox MB_OK "Setting up languages..."
# setup # setup
; switches: ; switches:
; -c ; -c
; -t :: setup the language files ; -t :: setup the language files
; -r ; -r
; ;
; pythonw grampsSetup.py -c -t ; pythonw grampsSetup.py -c -t
#Exec '"$3" $\"$INSTDIR\grampsSetup.py -c -t -r$\"' #Exec '"$3" $\"$INSTDIR\grampsSetup.py -c -t -r$\"'
SectionEnd SectionEnd
@ -266,9 +289,9 @@ SectionEnd
; ;
; Example: ; Example:
; !insertmacro APP_ASSOCIATE \ ; !insertmacro APP_ASSOCIATE \
; "txt" \ ; "txt" \
; "myapp.textfile" \ ; "myapp.textfile" \
; "myapp tiny description" \ ; "myapp tiny description" \
; "$INSTDIR\myapp.exe,0" \ ; "$INSTDIR\myapp.exe,0" \
; "Open with myapp" \ ; "Open with myapp" \
; "$INSTDIR\myapp.exe $\"%1$\"" ; "$INSTDIR\myapp.exe $\"%1$\""
@ -308,54 +331,54 @@ SectionEnd
; ;
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND !macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
; Backup the previously associated file class ; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" "" ReadRegStr $R0 HKCR ".${EXT}" ""
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0" WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}" WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}` WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}` WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr HKCR "${FILECLASS}\shell" "" "open" WriteRegStr HKCR "${FILECLASS}\shell" "" "open"
WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}` WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}` WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}`
!macroend !macroend
!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND !macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
; Backup the previously associated file class ; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" "" ReadRegStr $R0 HKCR ".${EXT}" ""
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0" WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}" WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
StrCmp "${SHELLNEW}" "0" +2 StrCmp "${SHELLNEW}" "0" +2
WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" "" WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" ""
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}` WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}` WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}` WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}` WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}` WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
!macroend !macroend
!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND !macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}` WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}` WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
!macroend !macroend
!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB !macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB
DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}` DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}`
!macroend !macroend
!macro APP_UNASSOCIATE EXT FILECLASS !macro APP_UNASSOCIATE EXT FILECLASS
; Backup the previously associated file class ; Backup the previously associated file class
ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup` ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup`
WriteRegStr HKCR ".${EXT}" "" "$R0" WriteRegStr HKCR ".${EXT}" "" "$R0"
DeleteRegKey HKCR `${FILECLASS}` DeleteRegKey HKCR `${FILECLASS}`
!macroend !macroend
!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT !macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT
ReadRegStr ${OUTPUT} HKCR ".${EXT}" "" ReadRegStr ${OUTPUT} HKCR ".${EXT}" ""
!macroend !macroend
@ -372,7 +395,7 @@ SectionEnd
!macro UPDATEFILEASSOC !macro UPDATEFILEASSOC
; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we ; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
; can update the shell. ; can update the shell.
System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)" System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
!macroend !macroend
;EOF ;EOF
@ -383,41 +406,41 @@ Section "File Association" FileAssoc
SectionIn 1 3 SectionIn 1 3
# depends on FileAssoc.nsh, by Saivert (http://nsis.sourceforge.net/FileAssoc) # depends on FileAssoc.nsh, by Saivert (http://nsis.sourceforge.net/FileAssoc)
# .grdb # .grdb
!insertmacro APP_ASSOCIATE \ !insertmacro APP_ASSOCIATE \
"grdb" \ "grdb" \
"application/x-gramps-database" \ "application/x-gramps-database" \
"GRAMPS database file" \ "GRAMPS database file" \
"$INSTDIR\images\ped24.ico" \ "$INSTDIR\images\ped24.ico" \
"Open with GRAMPS" \ "Open with GRAMPS" \
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\"" "$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
# .gramps # .gramps
!insertmacro APP_ASSOCIATE \ !insertmacro APP_ASSOCIATE \
"gramps" \ "gramps" \
"application/x-gramps-file" \ "application/x-gramps-file" \
"GRAMPS application file" \ "GRAMPS application file" \
"$INSTDIR\images\ped24.ico" \ "$INSTDIR\images\ped24.ico" \
"Open with GRAMPS" \ "Open with GRAMPS" \
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\"" "$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
# .gpkg # .gpkg
!insertmacro APP_ASSOCIATE \ !insertmacro APP_ASSOCIATE \
"gpkg" \ "gpkg" \
"application/x-gramps-package" \ "application/x-gramps-package" \
"GRAMPS package file" \ "GRAMPS package file" \
"$INSTDIR\images\ped24.ico" \ "$INSTDIR\images\ped24.ico" \
"Open with GRAMPS" \ "Open with GRAMPS" \
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\"" "$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
# .ged # .ged
!insertmacro APP_ASSOCIATE \ !insertmacro APP_ASSOCIATE \
"ged" \ "ged" \
"application/x-gramps-gedcom" \ "application/x-gramps-gedcom" \
"GEnealogical Data COMmunication (GEDCOM) file" \ "GEnealogical Data COMmunication (GEDCOM) file" \
"$INSTDIR\images\ped24.ico" \ "$INSTDIR\images\ped24.ico" \
"Open with GRAMPS" \ "Open with GRAMPS" \
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\"" "$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
SectionEnd SectionEnd
@ -426,22 +449,22 @@ SectionEnd
Section Uninstall Section Uninstall
# ask first # ask first
MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 \ MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 \
"Completely remove installation? $\n\ "Completely remove installation? $\n\
(Delete folder $INSTDIR ) " \ (Delete folder $INSTDIR ) " \
IDNO unQuit IDYES unContinue IDNO unQuit IDYES unContinue
unQuit: unQuit:
Abort Abort
unContinue: unContinue:
ClearErrors ClearErrors
RMDir /r $INSTDIR RMDir /r $INSTDIR
Call un.StartMenu Call un.StartMenu
Call un.Desktop Call un.Desktop
unEnd: unEnd:
SectionEnd SectionEnd
@ -454,196 +477,216 @@ Function .onInit
#MessageBox MB_OK "Testing dependencies..." #MessageBox MB_OK "Testing dependencies..."
; look for pythonw.exe ; look for pythonw.exe
; NOTE: This is set to $3 if it exists. ; NOTE: This is set to $3 if it exists.
; on path ; on path
SearchPath $3 pythonw.exe SearchPath $3 pythonw.exe
#MessageBox MB_OK "DEBUG: Testing pythonw.exe on path...$\n$\nFound: $\"$3$\"" #MessageBox MB_OK "DEBUG: Testing pythonw.exe on path...$\n$\nFound: $\"$3$\""
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; registry keys (these are confirmed possibilities) ; registry keys (these are confirmed possibilities)
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\python.exe' "" ReadRegStr $3 HKLM 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\python.exe' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key (updated on 2.5 upgrade) ; reg key (updated on 2.5 upgrade)
ReadRegStr $3 HKCR 'Python.File\shell\open\command' "" ReadRegStr $3 HKCR 'Python.File\shell\open\command' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key (updated on 2.5 upgrade) ; reg key (updated on 2.5 upgrade)
ReadRegStr $3 HKCU 'Software\Classes\Python.File\shell\open\command' "" ReadRegStr $3 HKCU 'Software\Classes\Python.File\shell\open\command' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\Current version\App Paths\Python.exe' "" ReadRegStr $3 HKCU 'Software\Microsoft\Windows\Current version\App Paths\Python.exe' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\ShellNoRoam\MUICache (data:python)' "" ReadRegStr $3 HKCU 'Software\Microsoft\Windows\ShellNoRoam\MUICache (data:python)' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key (Python version 2.5) ; reg key (Python version 2.5)
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\InstallPath' "" ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\InstallPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key (Python version 2.4) ; reg key (Python version 2.4)
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\InstallPath' "" ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\InstallPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
# these hold compound paths # these hold compound paths
#; reg key (Python version 2.5) #; reg key (Python version 2.5)
#ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\PythonPath' "" #ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\PythonPath' ""
#StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" #StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
#IfFileExists $3 HavePython 0 #IfFileExists $3 HavePython 0
#; reg key (Python version 2.4) #; reg key (Python version 2.4)
#ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\PythonPath' "" #ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\PythonPath' ""
#StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" #StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
#IfFileExists $3 HavePython 0 #IfFileExists $3 HavePython 0
; Keys not prone to be properly updated on upgrades ; Keys not prone to be properly updated on upgrades
; reg key ; reg key
ReadRegStr $3 HKCR 'Applications\python.exe\shell\open\command' "" ReadRegStr $3 HKCR 'Applications\python.exe\shell\open\command' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key (not updated on 2.5 upgrade) ; reg key (not updated on 2.5 upgrade)
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\PythonPath' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\PythonPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\PythonPath' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\PythonPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\InstallPath' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\InstallPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; reg key ; reg key
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\InstallPath' "" ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\InstallPath' ""
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe" StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
IfFileExists $3 HavePython 0 IfFileExists $3 HavePython 0
; TODO: request path from user/browse (can NSIS do this?) ; TODO: request path from user/browse (can NSIS do this?)
MessageBox MB_OK "GRAMPS requires Python to be installed, please see:$\n \ #MessageBox MB_OK "GRAMPS requires Python to be installed, please see:$\n \
$\n \ # $\n \
http://gramps-project.org/windows/ $\n \ # http://gramps-project.org/windows/ $\n \
$\n \ # $\n \
for installation help. Unable to continue installation." # for installation help. Unable to continue installation."
Abort #Abort
HavePython: MessageBox MB_OK "Python not found."
StrCpy $4 "flag"
HavePython:
#MessageBox MB_OK "DEBUG: Final path for pythonw.exe...$\n$\nFound: $\"$3$\"" #MessageBox MB_OK "DEBUG: Final path for pythonw.exe...$\n$\nFound: $\"$3$\""
; extract gcheck ; extract gcheck
SetOutPath $TEMP SetOutPath $TEMP
#MessageBox MB_OK "DEBUG: $$TEMP location found:$\n$\n $TEMP" #MessageBox MB_OK "DEBUG: $$TEMP location found:$\n$\n $TEMP"
File gcheck.py File gcheck.py
; set INI output location ($1) ; set INI output location ($1)
StrCpy $1 "$TEMP\gramps-install.ini" StrCpy $1 "$TEMP\gramps-install.ini"
#MessageBox MB_OK "DEBUG: Attempting to run:$\n$\n $\"$3$\" $TEMP\gcheck.py $1" #MessageBox MB_OK "DEBUG: Attempting to run:$\n$\n $\"$3$\" $TEMP\gcheck.py $1"
; run gcheck ; run gcheck
Exec '"$3" $TEMP\gcheck.py $1' Exec '"$3" $TEMP\gcheck.py $1'
#Exec '"$3" "$TEMP\gcheck.py" "$1"'
#Exec '$\"$3$\" $\"$TEMP\gcheck.py$\" $\"$1$\"'
; Note The Exec above is a fork, meaning the following file test #; Note The Exec above is a fork, meaning the following file test
; will fail because it happens faster than the Exec can run #; will fail because it happens faster than the Exec can run
; to create it! #; to create it!
DetailPrint "Pausing for gcheck.py exectution..." DetailPrint "Pausing for gcheck.py exectution..."
; sleep #; sleep
Sleep 6000 Sleep 1000
; verify INI created ; verify INI created
IfFileExists $1 YesINI 0 IfFileExists $1 YesINI 0
MessageBox MB_OK "Dependency test INI creation failed, unable to continue." #MessageBox MB_OK "Dependency test INI creation failed, unable to continue."
Abort #Abort
YesINI: MessageBox MB_OK "Dependency test INI creation failed."
StrCpy $4 "flag"
YesINI:
; verify environment test results ; verify environment test results
; GTK+ and pygtk ; GTK+ and pygtk
ReadINIStr $0 $1 tests gtk ReadINIStr $0 $1 tests gtk
StrCmp $0 "yes" HaveGTK 0 StrCmp $0 "yes" HaveGTK 0
; TODO: if no, perhaps just have GTK+ installed, check registry ; TODO: if no, perhaps just have GTK+ installed, check registry
; reg key ; reg key
ReadRegStr $3 HKCU 'Environment\GTK_BASEPATH' "" ReadRegStr $3 HKCU 'Environment\GTK_BASEPATH' ""
IfFileExists $3\*.* NoHavePyGTK 0 IfFileExists $3\*.* NoHavePyGTK 0
; reg key ; reg key
ReadRegStr $3 HKCU 'Software\GTK\2.0\Path' "" ReadRegStr $3 HKCU 'Software\GTK\2.0\Path' ""
IfFileExists $3\*.* NoHavePyGTK 0 IfFileExists $3\*.* NoHavePyGTK 0
; reg key ; reg key
ReadRegStr $3 HKLM 'Software\GTK\2.0\Path' "" ReadRegStr $3 HKLM 'Software\GTK\2.0\Path' ""
IfFileExists $3\*.* NoHavePyGTK 0 IfFileExists $3\*.* NoHavePyGTK 0
; reg key ; reg key
ReadRegStr $3 HKLM 'Software\GTK\2.0\DllPath' "" ReadRegStr $3 HKLM 'Software\GTK\2.0\DllPath' ""
IfFileExists $3\*.* NoHavePyGTK 0 IfFileExists $3\*.* NoHavePyGTK 0
; if we make it this far, we don't have GTK+ ; if we make it this far, we don't have GTK+
MessageBox MB_OK "GRAMPS requires GTK+ and PyGTK to be installed, please see:$\n \ #MessageBox MB_OK "GRAMPS requires GTK+ and PyGTK to be installed, please see:$\n \
$\n \ # $\n \
http://gramps-project.org/windows/ $\n \ # http://gramps-project.org/windows/ $\n \
$\n \ # $\n \
for installation help. Unable to continue installation." # for installation help. Unable to continue installation."
Abort #Abort
MessageBox MB_OK "GTK+ and PyGTK not found."
StrCpy $4 "flag"
NoHavePyGTK: NoHavePyGTK:
MessageBox MB_OK "GTK+/PyGTK import failed (GTK+ found on system), please see:$\n \ #MessageBox MB_OK "PyGTK import failed (GTK+ found on system), please see:$\n \
$\n \ # $\n \
http://gramps-project.org/windows/ $\n \ # http://gramps-project.org/windows/ $\n \
$\n \ # $\n \
for installation help. Unable to continue installation." # for installation help. Unable to continue installation."
Abort #Abort
MessageBox MB_OK "PyGTK not found."
StrCpy $4 "flag"
HaveGTK: HaveGTK:
# NOTE: we can not detect just pygtk via gcheck.py # NOTE: we can not detect just pygtk via gcheck.py
; glade ; glade
ReadINIStr $0 $1 tests glade ReadINIStr $0 $1 tests glade
StrCmp $0 "yes" Haveglade 0 StrCmp $0 "yes" Haveglade 0
MessageBox MB_OK "glade not installed, unable to continue." #MessageBox MB_OK "glade not installed, unable to continue."
Abort #Abort
Haveglade: MessageBox MB_OK "Glade not found."
; pycairo StrCpy $4 "flag"
ReadINIStr $0 $1 tests pycairo Haveglade:
StrCmp $0 "yes" Havepycairo 0 ; pycairo
MessageBox MB_OK "pycairo not installed, unable to continue." ReadINIStr $0 $1 tests pycairo
Abort StrCmp $0 "yes" Havepycairo 0
Havepycairo: #MessageBox MB_OK "pycairo not installed, unable to continue."
#Abort
MessageBox MB_OK "pycairo not found."
StrCpy $4 "flag"
Havepycairo:
#!insertmacro MUI_LANGDLL_DISPLAY #!insertmacro MUI_LANGDLL_DISPLAY
# default install directory ($INSTDIR) StrCmp $4 "flag" +1 DependantsOK
StrCpy $INSTDIR $PROGRAMFILES\gramps MessageBox MB_OK "At least one dependency was not found, unable to continue."
Abort
DependantsOK:
# default install directory ($INSTDIR)
StrCpy $INSTDIR $PROGRAMFILES\gramps
FunctionEnd FunctionEnd
Function .onInstSuccess Function .onInstSuccess
# write uninstaller # write uninstaller
WriteUninstaller $INSTDIR\uninstall.exe WriteUninstaller $INSTDIR\uninstall.exe
FunctionEnd FunctionEnd
Function .onInstFailed Function .onInstFailed
MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed." MessageBox MB_OK|MB_ICONEXCLAMATION "Installation failed."
FunctionEnd FunctionEnd
Function WarnDirExists Function WarnDirExists
# warn if dir already exists # warn if dir already exists
IfFileExists $INSTDIR\*.* DirExists DirExistsOK IfFileExists $INSTDIR\*.* DirExists DirExistsOK
DirExists: DirExists:
MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 \ MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2 \
"Install over existing?" \ "Install over existing?" \
IDYES DirExistsOK IDYES DirExistsOK
Quit Quit
DirExistsOK: DirExistsOK:
FunctionEnd FunctionEnd
# Uninstaller {{{1 # Uninstaller {{{1
@ -655,17 +698,17 @@ FunctionEnd
Function un.StartMenu Function un.StartMenu
IfFileExists "$SMPROGRAMS\GRAMPS" 0 unStartMenuFine IfFileExists "$SMPROGRAMS\GRAMPS" 0 unStartMenuFine
RMDir /r "$SMPROGRAMS\GRAMPS\" RMDir /r "$SMPROGRAMS\GRAMPS\"
unStartMenuFine: unStartMenuFine:
FunctionEnd FunctionEnd
Function un.Desktop Function un.Desktop
IfFileExists "$DESKTOP\GRAMPS.lnk" 0 unNoDesktop IfFileExists "$DESKTOP\GRAMPS.lnk" 0 unNoDesktop
Delete "$DESKTOP\GRAMPS.lnk" Delete "$DESKTOP\GRAMPS.lnk"
unNoDesktop: unNoDesktop:
FunctionEnd FunctionEnd
@ -674,25 +717,25 @@ FunctionEnd
###################################################################### ######################################################################
# (must be last) # (must be last)
LangString DESC_Main ${LANG_ENGLISH} "Main program files (required)." LangString DESC_Main ${LANG_ENGLISH} "Main program files (required)."
LangString DESC_MenusAndIcons ${LANG_ENGLISH} "General Desktop and Start Menu shortcut options." LangString DESC_MenusAndIcons ${LANG_ENGLISH} "General Desktop and Start Menu shortcut options."
LangString DESC_Desktop ${LANG_ENGLISH} "Add icon to the Desktop." LangString DESC_Desktop ${LANG_ENGLISH} "Add icon to the Desktop."
LangString DESC_MenuStart ${LANG_ENGLISH} "Add icons to the Start Menu." LangString DESC_MenuStart ${LANG_ENGLISH} "Add icons to the Start Menu."
LangString DESC_LangFiles ${LANG_ENGLISH} "Set up non-English languages." LangString DESC_LangFiles ${LANG_ENGLISH} "Set up non-English languages."
LangString DESC_FileAssoc ${LANG_ENGLISH} "Associate GRAMPS with .grdb, .gramps, .gpkg, and .ged files." LangString DESC_FileAssoc ${LANG_ENGLISH} "Associate GRAMPS with .grdb, .gramps, .gpkg, and .ged files."
LangString DESC_Prog ${LANG_ENGLISH} "GRAMPS..." LangString DESC_Prog ${LANG_ENGLISH} "GRAMPS..."
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${Main} $(DESC_Main) !insertmacro MUI_DESCRIPTION_TEXT ${Main} $(DESC_Main)
!insertmacro MUI_DESCRIPTION_TEXT ${MenusAndIcons} $(DESC_MenusAndIcons) !insertmacro MUI_DESCRIPTION_TEXT ${MenusAndIcons} $(DESC_MenusAndIcons)
!insertmacro MUI_DESCRIPTION_TEXT ${Desktop} $(DESC_Desktop) !insertmacro MUI_DESCRIPTION_TEXT ${Desktop} $(DESC_Desktop)
!insertmacro MUI_DESCRIPTION_TEXT ${MenuStart} $(DESC_MenuStart) !insertmacro MUI_DESCRIPTION_TEXT ${MenuStart} $(DESC_MenuStart)
!insertmacro MUI_DESCRIPTION_TEXT ${LangFiles} $(DESC_LangFiles) !insertmacro MUI_DESCRIPTION_TEXT ${LangFiles} $(DESC_LangFiles)
!insertmacro MUI_DESCRIPTION_TEXT ${FileAssoc} $(DESC_FileAssoc) !insertmacro MUI_DESCRIPTION_TEXT ${FileAssoc} $(DESC_FileAssoc)
!insertmacro MUI_DESCRIPTION_TEXT ${Prog} $(DESC_Prog) !insertmacro MUI_DESCRIPTION_TEXT ${Prog} $(DESC_Prog)
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
# 1}}} # 1}}}
# vim:foldmethod=marker:noexpandtab # vim:foldmethod=marker:noexpandtab