Improved windows installer scripts from Steve.
svn: r8592
This commit is contained in:
parent
5d4434fda0
commit
5ccf7a65df
@ -56,14 +56,19 @@ rem *****************************************************
|
||||
rem * MAKE ALL ADJUSTMENTS IN THIS SECTION! *
|
||||
|
||||
rem version (also used for location
|
||||
set VERSION=2
|
||||
set VERSIONSUB=1
|
||||
set VERSIONPT=90
|
||||
set VERSION=0
|
||||
set VERSIONSUB=0
|
||||
set VERSIONPT=0
|
||||
set VERSIONBUILD=0
|
||||
|
||||
rem path to Nullsoft Installer (NSIS)
|
||||
set NSIS=C:\PROGRA~1\NSIS
|
||||
rem path to Nullsoft customized files
|
||||
set NSISFIXES=C:\DOCUME~1\HALLS~1.PER\_seh\devel\gramps
|
||||
set CUSTOM=C:\DOCUME~1\HALLS~1.PER\_seh\devel\gramps
|
||||
|
||||
rem path to Python
|
||||
if "%PYTHONPATH%"=="" echo Manually setting $PYTHONPATH...
|
||||
if "%PYTHONPATH%"=="" set PYTHONPATH=C:\Python25
|
||||
|
||||
rem * END OF ADJUSTMENTS SECTION *
|
||||
rem ******************************************************
|
||||
@ -94,7 +99,7 @@ echo.
|
||||
echo %%BUILDPATH%% : %BUILDPATH%
|
||||
echo %%VERSIONNAME%% : %VERSIONNAME%
|
||||
echo %%NSIS%% : %NSIS%
|
||||
echo %%NSISFIXES%% : %NSISFIXES%
|
||||
echo %%CUSTOM%% : %CUSTOM%
|
||||
|
||||
rem date
|
||||
for /F "TOKENS=1* DELIMS= " %%A in ('date/t') do set MYDAYNAME=%%A
|
||||
@ -107,6 +112,7 @@ rem time
|
||||
for /F "TOKENS=2* DELIMS=: " %%A in ('time/t') do set MYMINUTE=%%A
|
||||
echo Date : %MYYEAR%-%MYMONTH%-%MYDAY%
|
||||
echo Time : %MYHOUR%:%MYMINUTE%
|
||||
echo Build version : %VERSIONBUILD%
|
||||
echo.
|
||||
|
||||
set TRY=gzip.exe
|
||||
@ -152,7 +158,7 @@ rem CHOOSE {{{1
|
||||
cls
|
||||
echo.
|
||||
echo ______________________________________________________________________________
|
||||
echo Updated: 2006-07-10
|
||||
echo Updated: 2007-06-18 07:09:16-0400
|
||||
echo.
|
||||
echo Please select a choice:
|
||||
echo.
|
||||
@ -245,12 +251,40 @@ echo.
|
||||
rem TODO: This should happen on the user's machine, since the process
|
||||
rem apparently embeds a number of paths into the result.
|
||||
|
||||
rem cd "%BUILDPATH%\%VERSIONNAME%"
|
||||
rem
|
||||
rem python grampsSetup.py -c
|
||||
echo.
|
||||
echo Translations...
|
||||
echo.
|
||||
|
||||
rem TODO: Brian's script doesn't work for me...
|
||||
rem cd "%BUILDPATH%\%VERSIONNAME%"
|
||||
rem if exist "%CUSTOM%\grampsSetup.py" copy /Y "%CUSTOM%\grampsSetup.py" "%BUILDPATH%\%VERSIONNAME%"
|
||||
rem if exist "%CUSTOM%\grampsSetup.py" echo Setting up language files (this could take a while)...
|
||||
rem rem Use Brian's grampsSetup.py utility...
|
||||
rem rem switches:
|
||||
rem rem -r :: release
|
||||
rem rem -c :: compile
|
||||
rem rem -t :: set up the language files
|
||||
rem rem Note: we use only "-t", we don't want to compile
|
||||
rem if exist "%CUSTOM%\grampsSetup.py" python grampsSetup.py -t
|
||||
|
||||
echo.
|
||||
echo Setting up language files...
|
||||
echo.
|
||||
cd "%BUILDPATH%\%VERSIONNAME%\po"
|
||||
rem create the directories
|
||||
for %%A in (*.po) do if not exist lang\%%~nA\LC_MESSAGES mkdir lang\%%~nA\LC_MESSAGES
|
||||
rem convert .po to gramps.mo (in directories)
|
||||
for %%A in (*.po) do %PYTHONPATH%\python %PYTHONPATH%\Tools\i18n\msgfmt.py -o lang\%%~nA\LC_MESSAGES\gramps.mo %%A & echo processing language %%~nA...
|
||||
|
||||
echo.
|
||||
echo Attempting to update build level in const.py to "%VERSIONBUILD%"...
|
||||
echo.
|
||||
cd "%BUILDPATH%\%VERSIONNAME%\src"
|
||||
sed -i -e "s/^\(version \s\+= \"%VERSION%\.%VERSIONSUB%\.%VERSIONPT%-\).\+\"/\1%VERSIONBUILD%\"/g" const.py
|
||||
rem ren sedDOSSUX const.py
|
||||
|
||||
if not "%RETURN%"=="no" echo.
|
||||
if not "%RETURN%"=="no" echo Nothing to do. (Build occurs on target on first run.)
|
||||
if not "%RETURN%"=="no" echo Did we enjoy building?
|
||||
if not "%RETURN%"=="no" pause
|
||||
if not "%RETURN%"=="no" goto CHOOSE
|
||||
|
||||
@ -272,15 +306,15 @@ echo copying customized NSIS files...
|
||||
rem copy /Y "%NSIS%\Contrib\Graphics\Icons\classic-install.ico" "%BUILDPATH%\%VERSIONNAME%\nsis\classic-install.ico"
|
||||
rem copy /Y "%NSIS%\Contrib\Graphics\Icons\classic-uninstall.ico" "%BUILDPATH%\%VERSIONNAME%\nsis\classic-uninstall.ico"
|
||||
rem copy /Y "%NSIS%\Contrib\Graphics\Header\win.bmp" "%BUILDPATH%\%VERSIONNAME%\nsis\win.bmp"
|
||||
rem if exist "%NSISFIXES%\nsis-splash.bmp" copy /Y "%NSISFIXES%\nsis-splash.bmp" "%BUILDPATH%\%VERSIONNAME%\nsis\nsis-splash.bmp"
|
||||
rem if exist "%NSISFIXES%\nsis-checkboxes.bmp" copy /Y "%NSISFIXES%\nsis-checkboxes.bmp" "%BUILDPATH%\%VERSIONNAME%\nsis\nsis-checkboxes.bmp"
|
||||
rem if exist "%CUSTOM%\nsis-splash.bmp" copy /Y "%CUSTOM%\nsis-splash.bmp" "%BUILDPATH%\%VERSIONNAME%\nsis\nsis-splash.bmp"
|
||||
rem if exist "%CUSTOM%\nsis-checkboxes.bmp" copy /Y "%CUSTOM%\nsis-checkboxes.bmp" "%BUILDPATH%\%VERSIONNAME%\nsis\nsis-checkboxes.bmp"
|
||||
|
||||
rem TODO:
|
||||
echo copying temporary, should end up in 2.1.8(?)
|
||||
echo copying temporary, should end up in next release (?)
|
||||
if not exist "%BUILDPATH%\%VERSIONNAME%\nsis\CON" mkdir "%BUILDPATH%\%VERSIONNAME%\nsis"
|
||||
if exist "%NSISFIXES%\gramps.nsi" copy /Y "%NSISFIXES%\gramps.nsi" /Y "%BUILDPATH%\%VERSIONNAME%\nsis\gramps.nsi"
|
||||
if exist "%NSISFIXES%\ped24.ico" copy /Y "%NSISFIXES%\ped24.ico" /Y "%BUILDPATH%\%VERSIONNAME%\src\images\ped24.ico"
|
||||
if exist "%NSISFIXES%\gcheck.py" copy /Y "%NSISFIXES%\gcheck.py" /Y "%BUILDPATH%\%VERSIONNAME%\nsis\gcheck.py"
|
||||
if exist "%CUSTOM%\gramps.nsi" copy /Y "%CUSTOM%\gramps.nsi" /Y "%BUILDPATH%\%VERSIONNAME%\nsis\gramps.nsi"
|
||||
if exist "%CUSTOM%\ped24.ico" copy /Y "%CUSTOM%\ped24.ico" /Y "%BUILDPATH%\%VERSIONNAME%\src\images\ped24.ico"
|
||||
if exist "%CUSTOM%\gcheck.py" copy /Y "%CUSTOM%\gcheck.py" /Y "%BUILDPATH%\%VERSIONNAME%\nsis\gcheck.py"
|
||||
|
||||
echo building installer...
|
||||
cd "%BUILDPATH%\%VERSIONNAME%\nsis"
|
||||
@ -300,9 +334,13 @@ echo -----------------------------------------------------------------
|
||||
echo Removing existing installation
|
||||
echo.
|
||||
|
||||
echo removing "%ProgramFiles%\gramps"
|
||||
if exist "%ProgramFiles%\gramps" rmdir /s /q "%ProgramFiles%\gramps"
|
||||
echo removing "%USERPROFILE%\Start Menu\Programs\GRAMPS"
|
||||
if exist "%USERPROFILE%\Start Menu\Programs\GRAMPS" rmdir /s /q "%USERPROFILE%\Start Menu\Programs\GRAMPS"
|
||||
echo removing "%TEMP%\gramps-install.ini"
|
||||
if exist "%TEMP%\gramps-install.ini" del "%TEMP%\gramps-install.ini"
|
||||
echo removing "%TEMP%\gcheck.py"
|
||||
if exist "%TEMP%\gcheck.py" del "%TEMP%\gcheck.py"
|
||||
|
||||
if not "%RETURN%"=="no" echo.
|
||||
@ -336,7 +374,7 @@ rem clear variables
|
||||
set MYDAYNAME=
|
||||
set MDY=
|
||||
set NSIS=
|
||||
set NSISFIXES=
|
||||
set CUSTOM=
|
||||
rem set PATHORIG=
|
||||
set RETURN=
|
||||
set TRY=
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Filename: gramps.nsi
|
||||
#
|
||||
# Description: Nullsoft Installer (NSIS) file to build Windows installer:
|
||||
# Updated: 2006-07-26 13:12:28-0400
|
||||
# Updated: 2007-06-18 07:09:38-0400
|
||||
# Author: Steve Hall [ digitect dancingpaper com ]
|
||||
#
|
||||
# Requires: NSIS version 2.0 or later.
|
||||
@ -12,6 +12,16 @@
|
||||
# o WARNING: Except the uninstaller. That re-paths for some reason.
|
||||
#
|
||||
|
||||
# ToDo {{{1
|
||||
#
|
||||
# o Option to remove existing installation prior to installing new
|
||||
# o More refined dependency checking (versioning)
|
||||
# o Add .gramps and .gpkg as extensions
|
||||
# * => Need separate icons for them?
|
||||
# o Add uninstall to Windows XP manifest list
|
||||
#
|
||||
|
||||
# 1}}}
|
||||
# Installer Attributes
|
||||
# 0. Base Settings {{{1
|
||||
|
||||
@ -19,13 +29,14 @@
|
||||
!define GRAMPS_VER_MAJOR $%VERSION%
|
||||
!define GRAMPS_VER_MINOR $%VERSIONSUB%
|
||||
!define GRAMPS_VER_POINT $%VERSIONPT%
|
||||
!define GRAMPS_VER_BUILD $%VERSIONBUILD%
|
||||
|
||||
# adds Native Language Support
|
||||
!define HAVE_NLS
|
||||
|
||||
# output file
|
||||
Name "GRAMPS"
|
||||
OutFile gramps-${GRAMPS_VER_MAJOR}.${GRAMPS_VER_MINOR}.${GRAMPS_VER_POINT}.exe
|
||||
OutFile gramps-${GRAMPS_VER_MAJOR}.${GRAMPS_VER_MINOR}.${GRAMPS_VER_POINT}-${GRAMPS_VER_BUILD}.exe
|
||||
|
||||
# self ensure we don't have a corrupted file
|
||||
CRCCheck on
|
||||
@ -40,6 +51,8 @@ SetDatablockOptimize on
|
||||
# comment next line if you don't have UPX (http://upx.sourceforge.net)
|
||||
!packhdr temp.dat "upx --best --compress-icons=0 temp.dat"
|
||||
|
||||
SetOverwrite try
|
||||
|
||||
# don't allow installation into C:\
|
||||
AllowRootDirInstall false
|
||||
|
||||
@ -72,7 +85,6 @@ SilentInstall normal
|
||||
# 1. Header file (Begin Modern User Interface) {{{1
|
||||
!include "MUI.nsh"
|
||||
|
||||
|
||||
# 2. Interface Configuration {{{1
|
||||
|
||||
# installer/uninstaller icons (these must match in size!)
|
||||
@ -97,7 +109,7 @@ SilentInstall normal
|
||||
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION $(^DirBrowseText)
|
||||
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
|
||||
|
||||
!define MUI_FINISHPAGE_RUN "python"
|
||||
!define MUI_FINISHPAGE_RUN "$3"
|
||||
!define MUI_FINISHPAGE_RUN_PARAMETERS "$\"$INSTDIR\gramps.py$\""
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
@ -123,55 +135,50 @@ SilentInstall normal
|
||||
|
||||
# 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"
|
||||
# Latin1
|
||||
!insertmacro MUI_LANGUAGE "Danish"
|
||||
#!insertmacro MUI_LANGUAGE "Default"
|
||||
!insertmacro MUI_LANGUAGE "Dutch"
|
||||
!insertmacro MUI_LANGUAGE "English"
|
||||
#!insertmacro MUI_LANGUAGE "Estonian"
|
||||
#!insertmacro MUI_LANGUAGE "Farsi"
|
||||
#!insertmacro MUI_LANGUAGE "Finnish"
|
||||
!insertmacro MUI_LANGUAGE "French"
|
||||
!insertmacro MUI_LANGUAGE "German"
|
||||
#!insertmacro MUI_LANGUAGE "Greek"
|
||||
#!insertmacro MUI_LANGUAGE "Hebrew"
|
||||
#!insertmacro MUI_LANGUAGE "Hungarian"
|
||||
#!insertmacro MUI_LANGUAGE "Indonesian"
|
||||
!insertmacro MUI_LANGUAGE "Italian"
|
||||
#!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 "Portuguese"
|
||||
!insertmacro MUI_LANGUAGE "PortugueseBR"
|
||||
#!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 "Spanish"
|
||||
#!insertmacro MUI_LANGUAGE "Swedish"
|
||||
#!insertmacro MUI_LANGUAGE "Thai"
|
||||
#!insertmacro MUI_LANGUAGE "TradChinese"
|
||||
#!insertmacro MUI_LANGUAGE "Turkish"
|
||||
#!insertmacro MUI_LANGUAGE "Ukrainian"
|
||||
|
||||
# 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
|
||||
|
||||
@ -191,19 +198,25 @@ SectionIn 1 2 3 RO
|
||||
|
||||
SectionEnd
|
||||
|
||||
# Icons, menus and shortcuts {{{1
|
||||
# Menus and shortcuts {{{1
|
||||
|
||||
SubSection "Icons, menus and shortcuts" MenusAndIcons
|
||||
SubSection "Menus and shortcuts" MenusAndIcons
|
||||
|
||||
Section "Add GRAMPS to the Start Menu" MenuStart
|
||||
SectionIn 1 3
|
||||
# determines "Start In" location for shortcuts
|
||||
SetOutPath $INSTDIR
|
||||
|
||||
StrCpy $0 "GRAMPS"
|
||||
|
||||
CreateDirectory "$SMPROGRAMS\GRAMPS\"
|
||||
CreateShortCut "$SMPROGRAMS\GRAMPS\GRAMPS.lnk" "$3" "$\"$INSTDIR\gramps.py$\"" "$INSTDIR\images\ped24.ico" "0" "" "" "GRAMPS"
|
||||
WriteINIStr "$SMPROGRAMS\GRAMPS\GRAMPS Website.url" "InternetShortcut" "URL" "http://www.gramps-project.org/"
|
||||
CreateShortCut "$SMPROGRAMS\GRAMPS\Uninstall GRAMPS.lnk" "$\"$INSTDIR\uninstall.exe$\"" "" "" "0" "" "" "Uninstall GRAMPS"
|
||||
IfFileExists "$SMPROGRAMS\$0" 0 skipStartMenuRemove
|
||||
RMDir /r "$SMPROGRAMS\$0\"
|
||||
skipStartMenuRemove:
|
||||
|
||||
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"
|
||||
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"
|
||||
|
||||
SectionEnd
|
||||
|
||||
@ -211,11 +224,203 @@ Section "Add Desktop icon" Desktop
|
||||
#SectionIn 1 3
|
||||
# determines "Start In" location for shortcuts
|
||||
SetOutPath $INSTDIR
|
||||
CreateShortCut "$DESKTOP\GRAMPS.lnk" "$3" "$\"$INSTDIR\gramps.py$\"" "$INSTDIR\images\ped24.ico" "0" "" "" "GRAMPS"
|
||||
CreateShortCut "$DESKTOP\GRAMPS ${GRAMPS_VER_MAJOR}.${GRAMPS_VER_MINOR}.${GRAMPS_VER_POINT}-${GRAMPS_VER_BUILD}.lnk" "$3" "$\"$INSTDIR\gramps.py$\"" "$INSTDIR\images\ped24.ico" "0" "" "" "GRAMPS"
|
||||
SectionEnd
|
||||
|
||||
SubSectionEnd
|
||||
|
||||
# Language Files {{{1
|
||||
|
||||
Section "Language Files" LangFiles
|
||||
|
||||
#CreateDirectory $INSTDIR\lang
|
||||
SetOutPath $INSTDIR
|
||||
File /r ..\po\*.mo
|
||||
|
||||
#MessageBox MB_OK "Setting up languages..."
|
||||
# setup
|
||||
; switches:
|
||||
; -c
|
||||
; -t :: setup the language files
|
||||
; -r
|
||||
;
|
||||
; pythonw grampsSetup.py -c -t
|
||||
#Exec '"$3" $\"$INSTDIR\grampsSetup.py -c -t -r$\"'
|
||||
|
||||
SectionEnd
|
||||
|
||||
# File Association {{{1
|
||||
|
||||
# FileAssoc.nsh macro {{{2
|
||||
;
|
||||
; FileAssoc.nsh (http://nsis.sourceforge.net/FileAssoc)
|
||||
; File association helper macros
|
||||
; Written by Saivert
|
||||
;
|
||||
; Features automatic backup system and UPDATEFILEASSOC macro for
|
||||
; shell change notification.
|
||||
;
|
||||
; |> How to use <|
|
||||
; To associate a file with an application so you can double-click it in explorer, use
|
||||
; the APP_ASSOCIATE macro like this:
|
||||
;
|
||||
; Example:
|
||||
; !insertmacro APP_ASSOCIATE \
|
||||
; "txt" \
|
||||
; "myapp.textfile" \
|
||||
; "myapp tiny description" \
|
||||
; "$INSTDIR\myapp.exe,0" \
|
||||
; "Open with myapp" \
|
||||
; "$INSTDIR\myapp.exe $\"%1$\""
|
||||
;
|
||||
; Never insert the APP_ASSOCIATE macro multiple times, it is only ment
|
||||
; to associate an application with a single file and using the
|
||||
; the "open" verb as default. To add more verbs (actions) to a file
|
||||
; use the APP_ASSOCIATE_ADDVERB macro.
|
||||
;
|
||||
; Example:
|
||||
; !insertmacro APP_ASSOCIATE_ADDVERB "myapp.textfile" "edit" "Edit with myapp" \
|
||||
; "$INSTDIR\myapp.exe /edit $\"%1$\""
|
||||
;
|
||||
; To have access to more options when registering the file association use the
|
||||
; APP_ASSOCIATE_EX macro. Here you can specify the verb and what verb is to be the
|
||||
; standard action (default verb).
|
||||
;
|
||||
; And finally: To remove the association from the registry use the APP_UNASSOCIATE
|
||||
; macro. Here is another example just to wrap it up:
|
||||
; !insertmacro APP_UNASSOCIATE "txt" "myapp.textfile"
|
||||
;
|
||||
; |> Note <|
|
||||
; When defining your file class string always use the short form of your application title
|
||||
; then a period (dot) and the type of file. This keeps the file class sort of unique.
|
||||
; Examples:
|
||||
; Winamp.Playlist
|
||||
; NSIS.Script
|
||||
; Photoshop.JPEGFile
|
||||
;
|
||||
; |> Tech info <|
|
||||
; The registry key layout for a file association is:
|
||||
; HKEY_CLASSES_ROOT
|
||||
; <applicationID> = <"description">
|
||||
; shell
|
||||
; <verb> = <"menu-item text">
|
||||
; command = <"command string">
|
||||
;
|
||||
|
||||
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 HKCR ".${EXT}" ""
|
||||
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
|
||||
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell" "" "open"
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\open" "" `${COMMANDTEXT}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_EX EXT FILECLASS DESCRIPTION ICON VERB DEFAULTVERB SHELLNEW COMMANDTEXT COMMAND
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 HKCR ".${EXT}" ""
|
||||
WriteRegStr HKCR ".${EXT}" "${FILECLASS}_backup" "$R0"
|
||||
|
||||
WriteRegStr HKCR ".${EXT}" "" "${FILECLASS}"
|
||||
StrCmp "${SHELLNEW}" "0" +2
|
||||
WriteRegStr HKCR ".${EXT}\ShellNew" "NullFile" ""
|
||||
|
||||
WriteRegStr HKCR "${FILECLASS}" "" `${DESCRIPTION}`
|
||||
WriteRegStr HKCR "${FILECLASS}\DefaultIcon" "" `${ICON}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell" "" `${DEFAULTVERB}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_ADDVERB FILECLASS VERB COMMANDTEXT COMMAND
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}" "" `${COMMANDTEXT}`
|
||||
WriteRegStr HKCR "${FILECLASS}\shell\${VERB}\command" "" `${COMMAND}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_REMOVEVERB FILECLASS VERB
|
||||
DeleteRegKey HKCR `${FILECLASS}\shell\${VERB}`
|
||||
!macroend
|
||||
|
||||
|
||||
!macro APP_UNASSOCIATE EXT FILECLASS
|
||||
; Backup the previously associated file class
|
||||
ReadRegStr $R0 HKCR ".${EXT}" `${FILECLASS}_backup`
|
||||
WriteRegStr HKCR ".${EXT}" "" "$R0"
|
||||
|
||||
DeleteRegKey HKCR `${FILECLASS}`
|
||||
!macroend
|
||||
|
||||
!macro APP_ASSOCIATE_GETFILECLASS OUTPUT EXT
|
||||
ReadRegStr ${OUTPUT} HKCR ".${EXT}" ""
|
||||
!macroend
|
||||
|
||||
|
||||
; !defines for use with SHChangeNotify
|
||||
!ifdef SHCNE_ASSOCCHANGED
|
||||
!undef SHCNE_ASSOCCHANGED
|
||||
!endif
|
||||
!define SHCNE_ASSOCCHANGED 0x08000000
|
||||
!ifdef SHCNF_FLUSH
|
||||
!undef SHCNF_FLUSH
|
||||
!endif
|
||||
!define SHCNF_FLUSH 0x1000
|
||||
|
||||
!macro UPDATEFILEASSOC
|
||||
; Using the system.dll plugin to call the SHChangeNotify Win32 API function so we
|
||||
; can update the shell.
|
||||
System::Call "shell32::SHChangeNotify(i,i,i,i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_FLUSH}, 0, 0)"
|
||||
!macroend
|
||||
|
||||
;EOF
|
||||
|
||||
# 2}}}
|
||||
|
||||
Section "File Association" FileAssoc
|
||||
SectionIn 1 3
|
||||
# depends on FileAssoc.nsh, by Saivert (http://nsis.sourceforge.net/FileAssoc)
|
||||
|
||||
# .grdb
|
||||
!insertmacro APP_ASSOCIATE \
|
||||
"grdb" \
|
||||
"application/x-gramps-database" \
|
||||
"GRAMPS database file" \
|
||||
"$INSTDIR\images\ped24.ico" \
|
||||
"Open with GRAMPS" \
|
||||
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
|
||||
|
||||
# .gramps
|
||||
!insertmacro APP_ASSOCIATE \
|
||||
"gramps" \
|
||||
"application/x-gramps-file" \
|
||||
"GRAMPS application file" \
|
||||
"$INSTDIR\images\ped24.ico" \
|
||||
"Open with GRAMPS" \
|
||||
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
|
||||
|
||||
# .gpkg
|
||||
!insertmacro APP_ASSOCIATE \
|
||||
"gpkg" \
|
||||
"application/x-gramps-package" \
|
||||
"GRAMPS package file" \
|
||||
"$INSTDIR\images\ped24.ico" \
|
||||
"Open with GRAMPS" \
|
||||
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
|
||||
|
||||
# .ged
|
||||
!insertmacro APP_ASSOCIATE \
|
||||
"ged" \
|
||||
"application/x-gramps-gedcom" \
|
||||
"GEnealogical Data COMmunication (GEDCOM) file" \
|
||||
"$INSTDIR\images\ped24.ico" \
|
||||
"Open with GRAMPS" \
|
||||
"$\"$3$\" $\"$INSTDIR\gramps.py$\" $\"%1$\""
|
||||
|
||||
SectionEnd
|
||||
|
||||
# Uninstall {{{1
|
||||
######################################################################
|
||||
|
||||
@ -247,64 +452,95 @@ SectionEnd
|
||||
|
||||
Function .onInit
|
||||
|
||||
; test for dependencies
|
||||
MessageBox MB_OK "Testing dependencies..."
|
||||
#MessageBox MB_OK "Testing dependencies..."
|
||||
|
||||
; look for python.exe
|
||||
; look for pythonw.exe
|
||||
; NOTE: This is set to $3 if it exists.
|
||||
|
||||
; on path
|
||||
SearchPath $3 python.exe
|
||||
#MessageBox MB_OK "DEBUG: Testing python.exe on path...$\n$\nFound: $\"$3$\""
|
||||
SearchPath $3 pythonw.exe
|
||||
#MessageBox MB_OK "DEBUG: Testing pythonw.exe on path...$\n$\nFound: $\"$3$\""
|
||||
IfFileExists $3 HavePython 0
|
||||
|
||||
; registry keys (these are confirmed possibilities)
|
||||
; reg key
|
||||
ReadRegStr $3 HKCR 'Applications\python.exe\shell\open\command' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; registry keys (these are confirmed possibilities)
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\python.exe' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key (updated on 2.5 upgrade)
|
||||
ReadRegStr $3 HKCR 'Python.File\shell\open\command' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key (updated on 2.5 upgrade)
|
||||
ReadRegStr $3 HKCU 'Software\Classes\Python.File\shell\open\command' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\Current version\App Paths\Python.exe' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\ShellNoRoam\MUICache (data:python)' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key (Python version 2.5)
|
||||
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\InstallPath' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key (Python version 2.4)
|
||||
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\InstallPath' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
# these hold compound paths
|
||||
#; reg key (Python version 2.5)
|
||||
#ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.5\PythonPath' ""
|
||||
#StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
#IfFileExists $3 HavePython 0
|
||||
#; reg key (Python version 2.4)
|
||||
#ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\PythonPath' ""
|
||||
#StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
#IfFileExists $3 HavePython 0
|
||||
|
||||
; Keys not prone to be properly updated on upgrades
|
||||
; reg key
|
||||
ReadRegStr $3 HKCR 'Applications\python.exe\shell\open\command' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key (not updated on 2.5 upgrade)
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\PythonPath' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\PythonPath' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.5\InstallPath' ""
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'SOFTWARE\Python\PythonCore\2.4\InstallPath' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCR 'Python.File\shell\open\command' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Classes\Python.File\shell\open\command' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\Current version\App Paths\Python.exe' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Microsoft\Windows\ShellNoRoam\MUICache (data:python)' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\InstallPath' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\Python\PythonCore\2.4\PythonPath' ""
|
||||
StrCpy $3 "$3python.exe" ; append "python.exe"
|
||||
StrCpy $3 "$3pythonw.exe" ; append "pythonw.exe"
|
||||
IfFileExists $3 HavePython 0
|
||||
|
||||
|
||||
; TODO: request path from user/browse (can NSIS do this?)
|
||||
MessageBox MB_OK "Python not found, unable to continue."
|
||||
MessageBox MB_OK "GRAMPS requires Python to be installed, please see:$\n \
|
||||
$\n \
|
||||
http://gramps-project.org/windows/ $\n \
|
||||
$\n \
|
||||
for installation help. Unable to continue installation."
|
||||
Abort
|
||||
HavePython:
|
||||
#MessageBox MB_OK "DEBUG: Final path for pythonw.exe...$\n$\nFound: $\"$3$\""
|
||||
|
||||
; extract gcheck
|
||||
SetOutPath $TEMP
|
||||
@ -316,12 +552,12 @@ Function .onInit
|
||||
; run gcheck
|
||||
Exec '"$3" $TEMP\gcheck.py $1'
|
||||
|
||||
; Note The Exec above is a fork, meaning the following file test
|
||||
; will fail because it happens faster than the Exec can run
|
||||
; to create it!
|
||||
DetailPrint "pausing..."
|
||||
Sleep 1000
|
||||
|
||||
; Note The Exec above is a fork, meaning the following file test
|
||||
; will fail because it happens faster than the Exec can run
|
||||
; to create it!
|
||||
DetailPrint "Pausing for gcheck.py exectution..."
|
||||
; sleep
|
||||
Sleep 6000
|
||||
|
||||
; verify INI created
|
||||
IfFileExists $1 YesINI 0
|
||||
@ -330,18 +566,44 @@ Function .onInit
|
||||
YesINI:
|
||||
|
||||
; verify environment test results
|
||||
; GTK+
|
||||
; GTK+ and pygtk
|
||||
ReadINIStr $0 $1 tests gtk
|
||||
StrCmp $0 "yes" HaveGTK 0
|
||||
MessageBox MB_OK "GTK+ not installed, unable to continue."
|
||||
|
||||
; TODO: if no, perhaps just have GTK+ installed, check registry
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Environment\GTK_BASEPATH' ""
|
||||
IfFileExists $3\*.* NoHavePyGTK 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKCU 'Software\GTK\2.0\Path' ""
|
||||
IfFileExists $3\*.* NoHavePyGTK 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'Software\GTK\2.0\Path' ""
|
||||
IfFileExists $3\*.* NoHavePyGTK 0
|
||||
; reg key
|
||||
ReadRegStr $3 HKLM 'Software\GTK\2.0\DllPath' ""
|
||||
IfFileExists $3\*.* NoHavePyGTK 0
|
||||
|
||||
; 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 \
|
||||
$\n \
|
||||
http://gramps-project.org/windows/ $\n \
|
||||
$\n \
|
||||
for installation help. Unable to continue installation."
|
||||
Abort
|
||||
|
||||
NoHavePyGTK:
|
||||
MessageBox MB_OK "GTK+/PyGTK import failed (GTK+ found on system), please see:$\n \
|
||||
$\n \
|
||||
http://gramps-project.org/windows/ $\n \
|
||||
$\n \
|
||||
for installation help. Unable to continue installation."
|
||||
Abort
|
||||
|
||||
HaveGTK:
|
||||
; pygtk
|
||||
ReadINIStr $0 $1 tests pygtk
|
||||
StrCmp $0 "yes" Havepygtk 0
|
||||
MessageBox MB_OK "pygtk not installed, unable to continue."
|
||||
Abort
|
||||
Havepygtk:
|
||||
|
||||
# NOTE: we can not detect just pygtk via gcheck.py
|
||||
|
||||
; glade
|
||||
ReadINIStr $0 $1 tests glade
|
||||
StrCmp $0 "yes" Haveglade 0
|
||||
@ -363,8 +625,10 @@ Function .onInit
|
||||
FunctionEnd
|
||||
|
||||
Function .onInstSuccess
|
||||
|
||||
# write uninstaller
|
||||
WriteUninstaller $INSTDIR\uninstall.exe
|
||||
|
||||
FunctionEnd
|
||||
|
||||
Function .onInstFailed
|
||||
@ -382,7 +646,6 @@ Function WarnDirExists
|
||||
DirExistsOK:
|
||||
FunctionEnd
|
||||
|
||||
|
||||
# Uninstaller {{{1
|
||||
#####################################################################
|
||||
|
||||
@ -415,6 +678,8 @@ FunctionEnd
|
||||
LangString DESC_MenusAndIcons ${LANG_ENGLISH} "General Desktop and Start Menu shortcut options."
|
||||
LangString DESC_Desktop ${LANG_ENGLISH} "Add icon to the Desktop."
|
||||
LangString DESC_MenuStart ${LANG_ENGLISH} "Add icons to the Start Menu."
|
||||
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_Prog ${LANG_ENGLISH} "GRAMPS..."
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
@ -423,6 +688,8 @@ FunctionEnd
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${MenusAndIcons} $(DESC_MenusAndIcons)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Desktop} $(DESC_Desktop)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${MenuStart} $(DESC_MenuStart)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${LangFiles} $(DESC_LangFiles)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${FileAssoc} $(DESC_FileAssoc)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Prog} $(DESC_Prog)
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
|
Loading…
Reference in New Issue
Block a user