[GRASS-SVN] r61982 - grass/branches/releasebranch_7_0/mswindows

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 15 11:51:01 PDT 2014


Author: hellik
Date: 2014-09-15 11:51:01 -0700 (Mon, 15 Sep 2014)
New Revision: 61982

Removed:
   grass/branches/releasebranch_7_0/mswindows/FileAssociation.nsh
Modified:
   grass/branches/releasebranch_7_0/mswindows/GRASS-Installer.nsi.tmpl
Log:
nsis: Clean downloaded MS runtime files  by .onInstSuccess; remove not needed py file association (bat-file solution for python scripts) (merge from trunk: 61911,61951,61952)

Deleted: grass/branches/releasebranch_7_0/mswindows/FileAssociation.nsh
===================================================================
--- grass/branches/releasebranch_7_0/mswindows/FileAssociation.nsh	2014-09-15 18:41:44 UTC (rev 61981)
+++ grass/branches/releasebranch_7_0/mswindows/FileAssociation.nsh	2014-09-15 18:51:01 UTC (rev 61982)
@@ -1,190 +0,0 @@
-/*
-_____________________________________________________________________________
- 
-                       File Association
-_____________________________________________________________________________
- 
- Based on code taken from http://nsis.sourceforge.net/File_Association 
- 
- Usage in script:
- 1. !include "FileAssociation.nsh"
- 2. [Section|Function]
-      ${FileAssociationFunction} "Param1" "Param2" "..." $var
-    [SectionEnd|FunctionEnd]
- 
- FileAssociationFunction=[RegisterExtension|UnRegisterExtension]
- 
-_____________________________________________________________________________
- 
- ${RegisterExtension} "[executable]" "[extension]" "[description]"
- 
-"[executable]"     ; executable which opens the file format
-                   ;
-"[extension]"      ; extension, which represents the file format to open
-                   ;
-"[description]"    ; description for the extension. This will be display in Windows Explorer.
-                   ;
- 
- 
- ${UnRegisterExtension} "[extension]" "[description]"
- 
-"[extension]"      ; extension, which represents the file format to open
-                   ;
-"[description]"    ; description for the extension. This will be display in Windows Explorer.
-                   ;
- 
-_____________________________________________________________________________
- 
-                         Macros
-_____________________________________________________________________________
- 
- Change log window verbosity (default: 3=no script)
- 
- Example:
- !include "FileAssociation.nsh"
- !insertmacro RegisterExtension
- ${FileAssociation_VERBOSE} 4   # all verbosity
- !insertmacro UnRegisterExtension
- ${FileAssociation_VERBOSE} 3   # no script
-*/
- 
- 
-!ifndef FileAssociation_INCLUDED
-!define FileAssociation_INCLUDED
- 
-!include Util.nsh
- 
-!verbose push
-!verbose 3
-!ifndef _FileAssociation_VERBOSE
-  !define _FileAssociation_VERBOSE 3
-!endif
-!verbose ${_FileAssociation_VERBOSE}
-!define FileAssociation_VERBOSE `!insertmacro FileAssociation_VERBOSE`
-!verbose pop
- 
-!macro FileAssociation_VERBOSE _VERBOSE
-  !verbose push
-  !verbose 3
-  !undef _FileAssociation_VERBOSE
-  !define _FileAssociation_VERBOSE ${_VERBOSE}
-  !verbose pop
-!macroend
- 
- 
- 
-!macro RegisterExtensionCall _EXECUTABLE _EXTENSION _DESCRIPTION
-  !verbose push
-  !verbose ${_FileAssociation_VERBOSE}
-  Push `${_DESCRIPTION}`
-  Push `${_EXTENSION}`
-  Push `${_EXECUTABLE}`
-  ${CallArtificialFunction} RegisterExtension_
-  !verbose pop
-!macroend
- 
-!macro UnRegisterExtensionCall _EXTENSION _DESCRIPTION
-  !verbose push
-  !verbose ${_FileAssociation_VERBOSE}
-  Push `${_EXTENSION}`
-  Push `${_DESCRIPTION}`
-  ${CallArtificialFunction} UnRegisterExtension_
-  !verbose pop
-!macroend
- 
- 
- 
-!define RegisterExtension `!insertmacro RegisterExtensionCall`
-!define un.RegisterExtension `!insertmacro RegisterExtensionCall`
- 
-!macro RegisterExtension
-!macroend
- 
-!macro un.RegisterExtension
-!macroend
- 
-!macro RegisterExtension_
-  !verbose push
-  !verbose ${_FileAssociation_VERBOSE}
- 
-  Exch $R2 ;exe
-  Exch
-  Exch $R1 ;ext
-  Exch
-  Exch 2
-  Exch $R0 ;desc
-  Exch 2
-  Push $0
-  Push $1
- 
-  ReadRegStr $1 HKCR $R1 ""  ; read current file association
-  StrCmp "$1" "" NoBackup  ; is it empty
-  StrCmp "$1" "$R0" NoBackup  ; is it our own
-    WriteRegStr HKCR $R1 "backup_val" "$1"  ; backup current value
-NoBackup:
-  WriteRegStr HKCR $R1 "" "$R0"  ; set our file association
- 
-  ReadRegStr $0 HKCR $R0 ""
-  StrCmp $0 "" 0 Skip
-    WriteRegStr HKCR "$R0" "" "$R0"
-    WriteRegStr HKCR "$R0\shell" "" "open"
-    WriteRegStr HKCR "$R0\DefaultIcon" "" "$R2,0"
-Skip:
-  WriteRegStr HKCR "$R0\shell\open\command" "" '"$R2" "%1"'
-  WriteRegStr HKCR "$R0\shell\edit" "" "Edit $R0"
-  WriteRegStr HKCR "$R0\shell\edit\command" "" '"$R2" "%1"'
- 
-  Pop $1
-  Pop $0
-  Pop $R2
-  Pop $R1
-  Pop $R0
- 
-  !verbose pop
-!macroend
- 
- 
- 
-!define UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
-!define un.UnRegisterExtension `!insertmacro UnRegisterExtensionCall`
- 
-!macro UnRegisterExtension
-!macroend
- 
-!macro un.UnRegisterExtension
-!macroend
- 
-!macro UnRegisterExtension_
-  !verbose push
-  !verbose ${_FileAssociation_VERBOSE}
- 
-  Exch $R1 ;desc
-  Exch
-  Exch $R0 ;ext
-  Exch
-  Push $0
-  Push $1
- 
-  ReadRegStr $1 HKCR $R0 ""
-  StrCmp $1 $R1 0 NoOwn ; only do this if we own it
-  ReadRegStr $1 HKCR $R0 "backup_val"
-  StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
-  DeleteRegKey HKCR $R0
-  Goto NoOwn
- 
-Restore:
-  WriteRegStr HKCR $R0 "" $1
-  DeleteRegValue HKCR $R0 "backup_val"
-  DeleteRegKey HKCR $R1 ;Delete key with association name settings
- 
-NoOwn:
- 
-  Pop $1
-  Pop $0
-  Pop $R1
-  Pop $R0
- 
-  !verbose pop
-!macroend
- 
-!endif # !FileAssociation_INCLUDED

Modified: grass/branches/releasebranch_7_0/mswindows/GRASS-Installer.nsi.tmpl
===================================================================
--- grass/branches/releasebranch_7_0/mswindows/GRASS-Installer.nsi.tmpl	2014-09-15 18:41:44 UTC (rev 61981)
+++ grass/branches/releasebranch_7_0/mswindows/GRASS-Installer.nsi.tmpl	2014-09-15 18:51:01 UTC (rev 61982)
@@ -59,7 +59,7 @@
 
 !include "MUI2.nsh"
 !include "LogicLib.nsh"
-!include "FileAssociation.nsh"
+!include "Sections.nsh"
 
 ;----------------------------------------------------------------------------------------------------------------------------
 
@@ -632,10 +632,6 @@
 	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "URLInfoAbout" "${WEB_SITE}"
 	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}" "Publisher" "${PUBLISHER}"
         
-        ;File Association
-        ;${registerExtension} "$INSTALL_DIR\extrabin\pythonw.exe" ".py"  "Python File"
-        ;${registerExtension} "$INSTALL_DIR\extrabin\pythonw.exe" ".pyc" "Compiled Python File"
-        ;${registerExtension} "$INSTALL_DIR\extrabin\pythonw.exe" ".pyw" "Python File (no console)"
 
 	;Create the Desktop Shortcut
 	SetShellVarContext current
@@ -935,16 +931,13 @@
 	untgz::extract "-d" "$TEMP\$ORIGINAL_UNTAR_FOLDER" "-zbz2" "$TEMP\$ARCHIVE_NAME"
 	Pop $0
 	StrCmp $0 "success" untar_ok untar_failed
-	
+
+	;move ExecWait, CopyFiles, Delete, RMDir commands out of the download function as these seems not to work if these are nested in a function
 	untar_ok:
 	ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2005_x86.exe" /q'
 	ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2008_x86.exe" /q'	
 	ExecWait '"$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\vcredist_2010_x86.exe" /q'
 	CopyFiles "$TEMP\$ORIGINAL_UNTAR_FOLDER\bin\*.dll" "$INSTALL_DIR\extrabin"
-	Delete "$TEMP\$ARCHIVE_NAME"
-	RMDir /r "$TEMP\$ORIGINAL_UNTAR_FOLDER"
-	;the following doesn't work. Maybe because the installer is still running?
-	RMDir "$TEMP\$ORIGINAL_UNTAR_FOLDER"
 	Goto end
 	
 	download_failed:
@@ -1068,7 +1061,18 @@
 SectionEnd
 
 ;--------------------------------------------------------------------------
+;Clean downloaded MS runtime files  by .onInstSuccess
 
+Function .onInstSuccess
+	${If} ${SectionIsSelected} ${SecMSRuntime}
+		Delete "$TEMP\$ARCHIVE_NAME"
+		RMDir /r "$TEMP\$ORIGINAL_UNTAR_FOLDER"
+		RMDir "$TEMP\$ORIGINAL_UNTAR_FOLDER"	
+	${EndIf}
+FunctionEnd
+
+;--------------------------------------------------------------------------
+
 ;Uninstaller Section
 
 Section "Uninstall"
@@ -1095,10 +1099,6 @@
 	DeleteRegKey HKLM "Software\${GRASS_BASE}"
 	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${GRASS_BASE}"
 
-        ;File Association
-        ${unregisterExtension} ".py"  "Python File"
-        ${unregisterExtension} ".pyc" "Compiled Python File"
-        ${unregisterExtension} ".pyw" "Python File (no console)"
 SectionEnd
 
 ;--------------------------------------------------------------------------



More information about the grass-commit mailing list