; Definitions will be added above SetCompressor lzma RequestExecutionLevel admin ; Modern UI installer stuff !include "MUI2.nsh" !define MUI_ABORTWARNING !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" ; UI pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_LANGUAGE "English" ; MUI end ------ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "${INSTALLER_NAME}" InstallDir "$PROGRAMFILES${BITNESS}\${PRODUCT_NAME}" ShowInstDetails show Section -SETTINGS SetOutPath "$INSTDIR" SetOverwrite ifnewer SectionEnd Section "Python ${PY_VERSION}" sec_py File "python-${PY_VERSION}${ARCH_TAG}.msi" DetailPrint "Installing Python ${PY_MAJOR_VERSION}, ${BITNESS} bit" ExecWait 'msiexec /i "$INSTDIR\python-${PY_VERSION}${ARCH_TAG}.msi" \ /qb ALLUSERS=1 TARGETDIR="$COMMONFILES${BITNESS}\Python\${PY_MAJOR_VERSION}"' Delete $INSTDIR\python-${PY_VERSION}${ARCH_TAG}.msi SectionEnd ;PYLAUNCHER_INSTALL ;------------------ Section "!${PRODUCT_NAME}" sec_app SectionIn RO SetShellVarContext all File ${PRODUCT_ICON} SetOutPath "$INSTDIR\pkgs" File /r "pkgs\*.*" SetOutPath "$INSTDIR" ;INSTALL_FILES ;INSTALL_DIRECTORIES ;INSTALL_SHORTCUTS ; Byte-compile Python files. DetailPrint "Byte-compiling Python modules..." nsExec::ExecToLog 'py -${PY_QUALIFIER} -m compileall -q "$INSTDIR\pkgs"' WriteUninstaller $INSTDIR\uninstall.exe ; Add ourselves to Add/remove programs WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "DisplayName" "${PRODUCT_NAME}" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "UninstallString" '"$INSTDIR\uninstall.exe"' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "InstallLocation" "$INSTDIR" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}" WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ "NoRepair" 1 SectionEnd Section "Uninstall" SetShellVarContext all Delete $INSTDIR\uninstall.exe Delete "$INSTDIR\${PRODUCT_ICON}" RMDir /r "$INSTDIR\pkgs" ;UNINSTALL_FILES ;UNINSTALL_DIRECTORIES ;UNINSTALL_SHORTCUTS RMDir $INSTDIR DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" SectionEnd ; Functions Function .onMouseOverSection ; Find which section the mouse is over, and set the corresponding description. FindWindow $R0 "#32770" "" $HWNDPARENT GetDlgItem $R0 $R0 1043 ; description item (must be added to the UI) StrCmp $0 ${sec_py} 0 +2 SendMessage $R0 ${WM_SETTEXT} 0 "STR:The Python interpreter. \ This is required for ${PRODUCT_NAME} to run." ; ;PYLAUNCHER_HELP ;------------------ StrCmp $0 ${sec_app} "" +2 SendMessage $R0 ${WM_SETTEXT} 0 "STR:${PRODUCT_NAME}" FunctionEnd