From 7e1b29e9e16ed7bcf92a5584dc0bd2e86fcd3a3d Mon Sep 17 00:00:00 2001 From: dalthviz Date: Wed, 6 Jul 2022 11:53:02 -0500 Subject: [PATCH 1/6] Add flag to kill child processes if Spyder is open while running installer --- nsist/spyder.nsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index cb9e3d1..a106916 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -274,7 +274,7 @@ Function validate_pre_install MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. All ${PRODUCT_NAME} running processes will stop. Are you sure you are want to close ${PRODUCT_NAME}?" \ /SD IDYES IDYES CloseSpyder IDNO NoClose CloseSpyder: - nsExec::Exec 'TaskKill /FI "WINDOWTITLE eq Spyder" /F' + nsExec::Exec 'TaskKill /FI "WINDOWTITLE eq Spyder" /F /T' goto notRunning NoClose: Quit From b6ee5cf6d6e5bf8f1bd3761b53bb7ea70afd8c1b Mon Sep 17 00:00:00 2001 From: dalthviz Date: Wed, 6 Jul 2022 14:00:10 -0500 Subject: [PATCH 2/6] Add banner when closing Spyder. Change 'Abort' for 'Quit' to actually quit installation process --- nsist/spyder.nsi | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index a106916..193fe7c 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -274,8 +274,10 @@ Function validate_pre_install MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. All ${PRODUCT_NAME} running processes will stop. Are you sure you are want to close ${PRODUCT_NAME}?" \ /SD IDYES IDYES CloseSpyder IDNO NoClose CloseSpyder: + Banner::show /set 76 "Please wait while closing Spyder..." " " nsExec::Exec 'TaskKill /FI "WINDOWTITLE eq Spyder" /F /T' - goto notRunning + Banner::destroy + GoTo notRunning NoClose: Quit notRunning: @@ -301,13 +303,10 @@ Function validate_pre_install ExecWait '"$uninstallPreviousInstallation" /S _?=$INSTDIR' Banner::destroy ${If} $0 <> 0 - MessageBox MB_YESNO|MB_ICONSTOP "Failed to uninstall, continue anyway?" /SD IDYES IDYES +2 - Abort + MessageBox MB_YESNO|MB_ICONSTOP "Failed to uninstall, continue anyway?" /SD IDYES IDYES NotInstalled IDNO NoUninstall ${EndIf} - GoTo NotInstalled NoUninstall: Quit - NotInstalled: FunctionEnd From c8a94d4b90d98b5a0731e99e050f414584ac6475 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Thu, 7 Jul 2022 15:27:50 -0500 Subject: [PATCH 3/6] Manually move uninstaller to temp dir before running it Prevent an error result from running the uninstaller when it is deleting the uninstaller executable from the installation dir --- nsist/spyder.nsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index 193fe7c..ad6895b 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -300,7 +300,10 @@ Function validate_pre_install /SD IDYES IDYES UninstallPreviousInstallation IDNO NoUninstall UninstallPreviousInstallation: Banner::show /set 76 "Please wait while uninstalling..." " " - ExecWait '"$uninstallPreviousInstallation" /S _?=$INSTDIR' + CreateDirectory $TEMP\spyder-uninstaller + CopyFiles /SILENT "$uninstallPreviousInstallation" $TEMP\spyder-uninstaller\uninstall.exe + ExecWait '"$TEMP\spyder-uninstaller\uninstall.exe" /S _?=$INSTDIR' $0 + RMDir /r $TEMP\spyder-uninstaller Banner::destroy ${If} $0 <> 0 MessageBox MB_YESNO|MB_ICONSTOP "Failed to uninstall, continue anyway?" /SD IDYES IDYES NotInstalled IDNO NoUninstall From 0baccd3a00f88cf9f3136c572264ae7ac550a945 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Thu, 7 Jul 2022 16:35:16 -0500 Subject: [PATCH 4/6] Restore 'GoTo NotInstalled' to continue installation process --- nsist/spyder.nsi | 1 + 1 file changed, 1 insertion(+) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index ad6895b..db319c0 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -308,6 +308,7 @@ Function validate_pre_install ${If} $0 <> 0 MessageBox MB_YESNO|MB_ICONSTOP "Failed to uninstall, continue anyway?" /SD IDYES IDYES NotInstalled IDNO NoUninstall ${EndIf} + GoTo NotInstalled NoUninstall: Quit NotInstalled: From 0593a90d39993f74a959a8b0100a69ac7e71a153 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Fri, 8 Jul 2022 13:51:34 -0500 Subject: [PATCH 5/6] Update dialog messages to stop/uninstall Spyder. Remove uninstall execution exit code validation --- nsist/spyder.nsi | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index db319c0..451e852 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -268,13 +268,13 @@ Function validate_pre_install FindWindow $0 "" "${PRODUCT_NAME}" IntCmp $0 0 notRunning - MessageBox MB_YESNO|MB_ICONINFORMATION "${PRODUCT_NAME} is running. You will need to close it first to proceed. Do you want to close ${PRODUCT_NAME} now?" \ + MessageBox MB_YESNO|MB_ICONINFORMATION "${PRODUCT_NAME} is running. It is necessary to close it before installing a new version. Do you want to close ${PRODUCT_NAME} now?" \ /SD IDYES IDYES Confirm IDNO NoClose Confirm: - MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. All ${PRODUCT_NAME} running processes will stop. Are you sure you are want to close ${PRODUCT_NAME}?" \ + MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. In addition, any program that you are running in ${PRODUCT_NAME}'s IPython console will be stopped. Are you sure you want to close ${PRODUCT_NAME}?" \ /SD IDYES IDYES CloseSpyder IDNO NoClose CloseSpyder: - Banner::show /set 76 "Please wait while closing Spyder..." " " + Banner::show /set 76 "Please wait while closing ${PRODUCT_NAME}..." " " nsExec::Exec 'TaskKill /FI "WINDOWTITLE eq Spyder" /F /T' Banner::destroy GoTo notRunning @@ -299,15 +299,12 @@ Function validate_pre_install MessageBox MB_YESNO|MB_ICONINFORMATION "${PRODUCT_NAME} is already installed. Uninstall the existing version?" \ /SD IDYES IDYES UninstallPreviousInstallation IDNO NoUninstall UninstallPreviousInstallation: - Banner::show /set 76 "Please wait while uninstalling..." " " + Banner::show /set 76 "Please wait while uninstalling ${PRODUCT_NAME}..." " " CreateDirectory $TEMP\spyder-uninstaller CopyFiles /SILENT "$uninstallPreviousInstallation" $TEMP\spyder-uninstaller\uninstall.exe - ExecWait '"$TEMP\spyder-uninstaller\uninstall.exe" /S _?=$INSTDIR' $0 + ExecWait '"$TEMP\spyder-uninstaller\uninstall.exe" /S _?=$INSTDIR' RMDir /r $TEMP\spyder-uninstaller Banner::destroy - ${If} $0 <> 0 - MessageBox MB_YESNO|MB_ICONSTOP "Failed to uninstall, continue anyway?" /SD IDYES IDYES NotInstalled IDNO NoUninstall - ${EndIf} GoTo NotInstalled NoUninstall: Quit From 0e00c23041b75df9b6465856ef9a94d6e1dd889d Mon Sep 17 00:00:00 2001 From: dalthviz Date: Mon, 11 Jul 2022 12:35:09 -0500 Subject: [PATCH 6/6] Further changes to dialog text and skip pages validation --- nsist/spyder.nsi | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/nsist/spyder.nsi b/nsist/spyder.nsi index 451e852..b837e4f 100644 --- a/nsist/spyder.nsi +++ b/nsist/spyder.nsi @@ -42,6 +42,7 @@ SetCompressor lzma !define MUI_PAGE_CUSTOMFUNCTION_PRE validate_pre_install !insertmacro MUI_PAGE_WELCOME [% if license_file %] +!define MUI_PAGE_CUSTOMFUNCTION_PRE validate_updating_and_skip !insertmacro MUI_PAGE_LICENSE [[license_file]] [% endif %] !insertmacro MULTIUSER_PAGE_INSTALLMODE @@ -59,8 +60,10 @@ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "${INSTALLER_NAME}" ShowInstDetails show +; Variables used globally Var cmdLineInstallDir Var uninstallPreviousInstallation +Var updatingInstallation Section -SETTINGS SetOutPath "$INSTDIR" @@ -271,7 +274,8 @@ Function validate_pre_install MessageBox MB_YESNO|MB_ICONINFORMATION "${PRODUCT_NAME} is running. It is necessary to close it before installing a new version. Do you want to close ${PRODUCT_NAME} now?" \ /SD IDYES IDYES Confirm IDNO NoClose Confirm: - MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. In addition, any program that you are running in ${PRODUCT_NAME}'s IPython console will be stopped. Are you sure you want to close ${PRODUCT_NAME}?" \ + MessageBox MB_YESNO|MB_ICONINFORMATION "All unsaved files and changes will be lost. In addition, any program that you are running in ${PRODUCT_NAME}'s IPython console will be stopped. \ + $\r$\n$\r$\nAre you sure you want to close ${PRODUCT_NAME}?" \ /SD IDYES IDYES CloseSpyder IDNO NoClose CloseSpyder: Banner::show /set 76 "Please wait while closing ${PRODUCT_NAME}..." " " @@ -305,12 +309,20 @@ Function validate_pre_install ExecWait '"$TEMP\spyder-uninstaller\uninstall.exe" /S _?=$INSTDIR' RMDir /r $TEMP\spyder-uninstaller Banner::destroy + StrCpy $updatingInstallation 1 + Abort GoTo NotInstalled NoUninstall: Quit NotInstalled: FunctionEnd +Function validate_updating_and_skip + ${If} $updatingInstallation == 1 + Abort + ${EndIf} +FunctionEnd + Function .onMouseOverSection ; Find which section the mouse is over, and set the corresponding description. FindWindow $R0 "#32770" "" $HWNDPARENT