diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2010-03-23 10:49:28 +0100 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2010-03-23 10:49:28 +0100 |
commit | d8d0a7fc3437546fb958783e81cf4ce5554f1572 (patch) | |
tree | da65b522ebd6a3aaf26acbd0a5881ed8e26e45bd | |
parent | ec2ae43ec56c404e9d0a38c5de8c75e61f09214e (diff) | |
download | pyexiv2-d8d0a7fc3437546fb958783e81cf4ce5554f1572.tar.gz |
Follow python's installation policy (all users or current user only).
-rw-r--r-- | win32-installer.nsi | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/win32-installer.nsi b/win32-installer.nsi index 7b3febd..bec7e82 100644 --- a/win32-installer.nsi +++ b/win32-installer.nsi @@ -20,24 +20,45 @@ Page custom InstallationOptions InstallationOptionsLeave !insertmacro MUI_LANGUAGE "English" +!define PYTHON_KEY "Software\Python\PythonCore\2.6\InstallPath" !define PYEXIV2_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\pyexiv2-0.2" +Var python_install_path Var system_wide Var user_site Function .onInit - Var /GLOBAL python_install_path - ReadRegStr $python_install_path HKLM Software\Python\PythonCore\2.6\InstallPath "" + SetShellVarContext all + ReadRegStr $python_install_path SHCTX ${PYTHON_KEY} "" StrCmp $python_install_path "" 0 Continue - ReadRegStr $python_install_path HKCU Software\Python\PythonCore\2.6\InstallPath "" + + SetShellVarContext current + ReadRegStr $python_install_path SHCTX ${PYTHON_KEY} "" StrCmp $python_install_path "" 0 Continue + MessageBox MB_OK|MB_ICONSTOP "Unable to locate Python 2.6." Quit + Continue: StrCpy $system_wide "$python_install_pathLib\site-packages" StrCpy $user_site "$APPDATA\Python\Python26\site-packages" FunctionEnd +Function un.onInit + SetShellVarContext all + ReadRegStr $INSTDIR SHCTX ${PYEXIV2_KEY} "InstallLocation" + StrCmp $INSTDIR "" 0 Continue + + SetShellVarContext current + ReadRegStr $INSTDIR SHCTX ${PYEXIV2_KEY} "InstallLocation" + StrCmp $INSTDIR "" 0 Continue + + MessageBox MB_OK|MB_ICONSTOP "Unable to locate $(^Name)." + Quit + + Continue: +FunctionEnd + Function InstallationOptions !insertmacro MUI_HEADER_TEXT "Installation options" "Choose where to install pyexiv2." @@ -82,19 +103,20 @@ Section "pyexiv2" File src\pyexiv2\utils.py WriteUninstaller $INSTDIR\pyexiv2-0.2-uninstaller.exe - WriteRegStr HKLM ${PYEXIV2_KEY} "DisplayName" "pyexiv2 0.2" - WriteRegStr HKLM ${PYEXIV2_KEY} "DisplayVersion" "0.2" - WriteRegStr HKLM ${PYEXIV2_KEY} "DisplayIcon" "$INSTDIR\pyexiv2-0.2-uninstaller.exe" - WriteRegStr HKLM ${PYEXIV2_KEY} "UninstallString" "$INSTDIR\pyexiv2-0.2-uninstaller.exe" - WriteRegDWORD HKLM ${PYEXIV2_KEY} "NoModify" 1 - WriteRegDWORD HKLM ${PYEXIV2_KEY} "NoRepair" 1 + WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayName" "pyexiv2 0.2" + WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayVersion" "0.2" + WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayIcon" "$INSTDIR\pyexiv2-0.2-uninstaller.exe" + WriteRegStr SHCTX ${PYEXIV2_KEY} "InstallLocation" $INSTDIR + WriteRegStr SHCTX ${PYEXIV2_KEY} "UninstallString" "$INSTDIR\pyexiv2-0.2-uninstaller.exe" + WriteRegDWORD SHCTX ${PYEXIV2_KEY} "NoModify" 1 + WriteRegDWORD SHCTX ${PYEXIV2_KEY} "NoRepair" 1 SectionEnd Section "Uninstall" Delete $INSTDIR\libexiv2python.py* RMDir /r $INSTDIR\pyexiv2 - DeleteRegKey HKLM ${PYEXIV2_KEY} + DeleteRegKey SHCTX ${PYEXIV2_KEY} Delete $INSTDIR\pyexiv2-0.2-uninstaller.exe SectionEnd |