Added macro to create detect functions

Renamed autodetect_python to detect_python
Added detect_gtk
This commit is contained in:
John Garland 2009-02-28 09:23:46 +00:00
commit 9b4e4e8d48

View file

@ -12,9 +12,13 @@
!define ${installer}_URL "http://download.deluge-torrent.org/windows/deps/${${installer}}" !define ${installer}_URL "http://download.deluge-torrent.org/windows/deps/${${installer}}"
!macroend !macroend
!macro autodetect component !macro create_detect component reg_path reg_key
Push ${${component}} Function detect_${component}
Call autodetect_${component} ReadRegStr $0 HKLM ${reg_path} ${reg_key}
IfErrors 0 +3
SectionSetInstTypes ${${component}} ${AUTO_FULL_INST}
SetCurInstType ${AUTODETECT_INST}
FunctionEnd
!macroend !macroend
!macro download url filename !macro download url filename
@ -50,12 +54,16 @@
; Redefine macros/functions ; Redefine macros/functions
!define create_url "!insertmacro create_url" !define create_url "!insertmacro create_url"
!define autodetect "!insertmacro autodetect" !define create_detect "!insertmacro create_detect"
!define download "!insertmacro download" !define download "!insertmacro download"
!define install_NSIS "!insertmacro install_NSIS" !define install_NSIS "!insertmacro install_NSIS"
!define install_MSI "!insertmacro install_MSI" !define install_MSI "!insertmacro install_MSI"
!define install_ZIP "!insertmacro install_ZIP" !define install_ZIP "!insertmacro install_ZIP"
; Installation types
!define AUTO_FULL_INST 3
!define AUTODETECT_INST 0
; Installer versions ; Installer versions
!define DELUGE_VERSION "1.1.3" !define DELUGE_VERSION "1.1.3"
!define PYTHON_VERSION "2.5" !define PYTHON_VERSION "2.5"
@ -102,6 +110,13 @@
${create_url} LIBTORRENT_INSTALLER ${create_url} LIBTORRENT_INSTALLER
${create_url} LIBTORRENT_DLL_ZIP ${create_url} LIBTORRENT_DLL_ZIP
; Installer registry paths
!define PYTHON_REG_PATH "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath"
!define GTK_REG_PATH "SOFTWARE\GTK\2.0"
; Installer registry keys
!define PYTHON_REG_KEY ""
!define GTK_REG_KEY "Path"
; Variables ; Variables
@ -360,21 +375,17 @@ SectionGroupEnd
; Functions ; Functions
Function autodetect_python ${create_detect} python ${PYTHON_REG_PATH} ${PYTHON_REG_KEY}
Pop $0 ${create_detect} gtk ${GTK_REG_PATH} ${GTK_REG_KEY}
ReadRegStr $1 HKLM "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath" ""
IfErrors 0 +3
SectionSetInstTypes $0 3
SetCurInstType 0
FunctionEnd
Function set_python_dir Function set_python_dir
ReadRegStr $PYTHONDIR HKLM "SOFTWARE\Python\PythonCore\${PYTHON_VERSION}\InstallPath" "" ReadRegStr $PYTHONDIR HKLM ${PYTHON_REG_PATH} ${PYTHON_REG_KEY}
IfErrors 0 +2 IfErrors 0 +2
StrCpy $PYTHONDIR "$INSTDIR\Python" StrCpy $PYTHONDIR "$INSTDIR\Python"
FunctionEnd FunctionEnd
Function .onInit Function .onInit
Call set_python_dir Call set_python_dir
${autodetect} python Call detect_python
Call detect_gtk
FunctionEnd FunctionEnd