123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- !define PRODUCT_NAME "[[ib.appname]]"
- !define PRODUCT_VERSION "[[ib.version]]"
- !define PY_VERSION "[[ib.py_version]]"
- !define PY_MAJOR_VERSION "[[ib.py_major_version]]"
- !define PY_QUALIFIER "[[ib.py_qualifier]]"
- !define BITNESS "[[ib.py_bitness]]"
- !define ARCH_TAG "[[arch_tag]]"
- !define INSTALLER_NAME "[[ib.installer_name]]"
- !define PRODUCT_ICON "[[icon]]"
-
- SetCompressor lzma
- RequestExecutionLevel admin
- [% block modernui %]
- ; 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"
- [% endblock modernui %]
- Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
- OutFile "${INSTALLER_NAME}"
- InstallDir "$PROGRAMFILES${BITNESS}\${PRODUCT_NAME}"
- ShowInstDetails show
- [% block sections %]
- 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
- Section "!${PRODUCT_NAME}" sec_app
- SectionIn RO
- SetShellVarContext all
- File ${PRODUCT_ICON}
- SetOutPath "$INSTDIR\pkgs"
- File /r "pkgs\*.*"
- SetOutPath "$INSTDIR"
-
- ; Install files
- [% for destination, group in grouped_files %]
- SetOutPath "[[destination]]"
- [% for file in group %]
- File "[[ file ]]"
- [% endfor %]
- [% endfor %]
-
- ; Install directories
- [% for dir, destination in ib.install_dirs %]
- SetOutPath "[[ pjoin(destination, dir) ]]"
- File /r "[[dir]]\*.*"
- [% endfor %]
-
- [% block install_shortcuts %]
- ; Install shortcuts
- ; The output path becomes the working directory for shortcuts
- SetOutPath "%HOMEDRIVE%\%HOMEPATH%"
- [% if single_shortcut %]
- [% for scname, sc in ib.shortcuts.items() %]
- CreateShortCut "$SMPROGRAMS\[[scname]].lnk" "[[sc['target'] ]]" \
- '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]"
- [% endfor %]
- [% else %]
- [# Multiple shortcuts: create a directory for them #]
- CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
- [% for scname, sc in ib.shortcuts.items() %]
- CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\[[scname]].lnk" "[[sc['target'] ]]" \
- '[[ sc['parameters'] ]]' "$INSTDIR\[[ sc['icon'] ]]"
- [% endfor %]
- [% endif %]
- SetOutPath "$INSTDIR"
- [% endblock 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
- [% for file, destination in ib.install_files %]
- Delete "[[pjoin(destination, file)]]"
- [% endfor %]
- ; Uninstall directories
- [% for dir, destination in ib.install_dirs %]
- RMDir /r "[[pjoin(destination, dir)]]"
- [% endfor %]
- [% block uninstall_shortcuts %]
- ; Uninstall shortcuts
- [% if single_shortcut %]
- [% for scname in ib.shortcuts %]
- Delete "$SMPROGRAMS\[[scname]].lnk"
- [% endfor %]
- [% else %]
- RMDir /r "$SMPROGRAMS\${PRODUCT_NAME}"
- [% endif %]
- [% endblock uninstall_shortcuts %]
- RMDir $INSTDIR
- DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
- SectionEnd
- [% endblock sections %]
- ; 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)
- [% block mouseover_messages %]
- StrCmp $0 ${sec_py} 0 +2
- SendMessage $R0 ${WM_SETTEXT} 0 "STR:The Python interpreter. \
- This is required for ${PRODUCT_NAME} to run."
- StrCmp $0 ${sec_app} "" +2
- SendMessage $R0 ${WM_SETTEXT} 0 "STR:${PRODUCT_NAME}"
-
- [% endblock mouseover_messages %]
- FunctionEnd
|