Changeset 7524


Ignore:
Timestamp:
Sep 23, 2009, 2:11:31 PM (15 years ago)
Author:
nariman
Message:

Added "Microsoft Visual C++ 2005 SP1 Redistributable Package". Fixed up deletion and addition of environmental paths.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • installation_files/windows/installer.nsi

    r7517 r7524  
    2626Var MinGWDir # mingw install root ($programfiles\mingw)
    2727Var NetCDFDir # netcdf binaries ($commonfiles\netcdf)
     28Var ScientificPythonInst #has ScientificPython been installed
     29Var NumpyInst #has Numpy been installed
     30Var MatplotlibInst #has matplotlib beeen installed
    2831# support variables for user dialogs
    2932Var Dialog
     
    7275# installer
    7376
     77Section "$(section_mvcrp)" sec_mvcrp
     78  #SectionIn RO # read only, it's required
     79  SetOutPath "${TemporaryFilesDir}"
     80  File "${FileSource}\prereqs\${MVCRPInst}"
     81  ExecWait "${TemporaryFilesDir}\${MVCRPInst} /Q"
     82SectionEnd
     83
    7484Section "$(section_netcdf)" sec_ncdf
    75   SectionIn RO # read only, it's required
     85  #SectionIn RO # read only, it's required
    7686  # install netcdf to default, no custom selection here
    7787  StrCpy $NetCDFDir "${NetCDFDefaultFolder}"
     
    99109Section "!$(section_anuga_install)" sec_install # anuga main
    100110  SectionIn RO
    101   # update path environment
    102   ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
    103   StrCpy $0 "$PythonDir;$MinGWDir\bin;$NetCDFDir;$0"
    104   WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
     111  # update path environment 
     112  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$PythonDir"
     113  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$MinGWDir\bin"
     114  ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$NetCDFDir"
     115  #ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
     116  #StrCpy $0 "$0;$PythonDir;$MinGWDir\bin;$NetCDFDir;"
     117  #WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
    105118  SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
    106 
    107119  StrCpy $PackagesDir "$PythonDir\Lib\site-packages"
    108120 
     
    120132  #Set MingG\bin environment path only for the installer to access gcc for compile all
    121133  ReadEnvStr $R0 "PATH"
    122   StrCpy $R0 "$R0;$MinGWDir\bin"
     134  StrCpy $R0 "$R0;$MinGWDir\bin;$PythonDir\DLLs"
    123135  System::Call 'Kernel32::SetEnvironmentVariableA(t, t) i("PATH", R0).r2'
    124136  ReadEnvStr $R0 "PATH"
     
    140152  Exec '"$PythonDir\python.exe" "$OUTDIR\validate_all.py"'
    141153SectionEnd
    142  
     154
     155!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
     156  !insertmacro MUI_DESCRIPTION_TEXT ${sec_mvcrp} $(description_mvcrp)
     157  !insertmacro MUI_DESCRIPTION_TEXT ${sec_ncdf} $(description_netcdf)
     158  !insertmacro MUI_DESCRIPTION_TEXT ${sec_install} $(description_anuga_install)
     159  !insertmacro MUI_DESCRIPTION_TEXT ${sec_test} $(description_anuga_test)
     160  !insertmacro MUI_DESCRIPTION_TEXT ${sec_validate} $(description_anuga_validate)
     161  !insertmacro MUI_DESCRIPTION_TEXT ${sec_viewer} $(description_anuga_viewer)
     162  !insertmacro MUI_DESCRIPTION_TEXT ${sec_ext} $(description_anuga_viewer_extension)
     163!insertmacro MUI_FUNCTION_DESCRIPTION_END
     164
     165# function executed on initialization of the installer
     166Function .onInit
     167    # prevent the installer from beeing executed twice a time
     168    System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .n ?e" # create a mutex
     169    Pop $0
     170    StrCmp $0 0 0 find
     171  Return # launch normaly if mutex could be created = no other instance running
     172 
     173  find:
     174    StrLen $0 "$(^Name)"
     175    IntOp $0 $0 + 1 
     176  loop:
     177    FindWindow $1 '#32770' '' 0 $1 # search the installers window if another instance is already running
     178    IntCmp $1 0 +4
     179    System::Call /NOUNLOAD "user32.dll::GetWindowText(i r1, t .r2, i r0) i.n"
     180    StrCmp $2 "$(^Name)" 0 loop # check back for correct window text
     181    System::Call "user32::SetForegroundWindow(i r1) i.n" # bring it to front if found
     182  Abort # then exit
     183FunctionEnd
     184
     185
     186Function .onGUIEnd
     187  RMDir /r "${TemporaryFilesDir}"
     188FunctionEnd
     189
     190
     191Function EnterPython
     192# installbutton and directory selection
     193  !insertmacro MUI_HEADER_TEXT "$(page_python_title)" "$(page_python_subtitle)"
     194  nsDialogs::Create 1018
     195  Pop $Dialog
     196  StrCmp $Dialog "error" 0 +2
     197  Abort
     198  GetDlgItem $Control0 $HWNDPARENT 1
     199 
     200  # get python directory
     201  ReadRegStr $PythonDir HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" ""
     202  StrLen $0 $PythonDir
     203  IntOp $0 $0 - 10
     204  StrCpy $PythonDir $PythonDir $0
     205 
     206  # select default, if possible from registry
     207  IfFileExists "$PythonDir\python.exe" +2
     208  StrCpy $PythonDir "C:\Python25"
     209 
     210  # create dialog items
     211  ${NSD_CreateLabel} 10 10 430 28 "$(page_python_install_label)"
     212  ${NSD_CreateButton} 40 50 370 24 "$(page_python_install_button)"
     213  Pop $Control1
     214  ${NSD_CreateLabel} 10 100 430 28 "$(page_python_browse_label)"
     215  ${NSD_CreateDirRequest} 40 140 290 24 "$PythonDir"
     216  Pop $Control2
     217  ${NSD_CreateButton} 340 140 70 24 "$(page_python_browse_button)"
     218  Pop $Control3
     219  ${NSD_CreateLabel} 10 190 430 28 "$(page_python_outro)"
     220 
     221  # register dialog actions
     222  ${NSD_OnClick} $Control1 RunPythonSetup
     223  ${NSD_OnChange} $Control2 ValidatePythonDir
     224  ${NSD_OnClick} $Control3 BrowsePythonDir
     225 
     226  # check for valid python directory
     227  Call ValidatePythonDir
     228 
     229  # show the page
     230  nsDialogs::Show
     231FunctionEnd
     232
     233# extract and run the python installer
     234Function RunPythonSetup
     235  SetOutPath "${TemporaryFilesDir}"
     236  File "${FileSource}\prereqs\${PythonInst}"
     237  ExecShell "" '"${TemporaryFilesDir}\${PythonInst}"'
     238  StrCpy $PythonInst "1"
     239  EnableWindow $Control0 1 # enable next button
     240FunctionEnd
     241
     242# browse for the python dir with a folder dialog
     243Function BrowsePythonDir
     244  nsDialogs::SelectFolderDialog "$(page_python_browse_dialog_title)" $PythonDir
     245  Pop $0
     246  StrCmp $0 "error" 0 +2
     247  Return
     248  ${NSD_SetText} $Control2 $0
     249  Call ValidatePythonDir
     250FunctionEnd
     251
     252# enable next button if selected python dir is valid
     253Function ValidatePythonDir
     254  ${NSD_GetText} $Control2 $PythonDir
     255  IfFileExists "$PythonDir\python.exe" ok
     256 
     257  EnableWindow $Control0 0
     258  Return
     259  ok:
     260  EnableWindow $Control0 1
     261FunctionEnd
     262
     263
     264Function EnterExtensions
     265# installbuttons for missing extensions
     266  !insertmacro MUI_HEADER_TEXT "$(page_extensions_title)" "$(page_extensions_subtitle)"
     267  nsDialogs::Create 1018
     268  Pop $Dialog
     269  StrCmp $Dialog "error" 0 +2
     270  Abort
     271  GetDlgItem $Control0 $HWNDPARENT 1
     272 
     273  ${NSD_CreateLabel} 10 10 430 28 "$(page_extensions_intro)"
     274  ${NSD_CreateLabel} 40 50 350 28 "$(page_extensions_numpy_ok)"
     275  Pop $Control1
     276  ${NSD_CreateLabel} 40 100 350 28 "$(page_extensions_scientific_ok)"
     277  Pop $Control2
     278  ${NSD_CreateLabel} 40 150 350 28 "$(page_extensions_matplotlib_ok)"
     279  Pop $Control3
     280  ${NSD_CreateLabel} 10 190 430 28 "$(page_extensions_outro_next)"
     281  Pop $Control4
     282 
     283  StrCpy $1 "0"
     284  StrCpy $2 "0"
     285  StrCpy $3 "0"
     286  StrCpy $4 "0"
     287  StrCpy $5 "0"
     288  IfFileExists "$PackagesDir\Numpy\*.py" 0 +2
     289  IntOp $1 $1 + 1
     290  IfFileExists "$PackagesDir\Scientific\*.py" 0 +2
     291  IntOp $2 $2 + 1
     292  IfFileExists "$PackagesDir\matplotlib\*.py" 0 +2
     293  IntOp $3 $3 + 1
     294  IntOp $4 $2 + $1
     295  IntOp $5 $4 + $3
     296 
     297  IntCmp $1 0 0 num_ok num_ok
     298  ${NSD_SetText} $Control1 "$(page_extensions_numpy_label_install)"
     299  num_ok:
     300 
     301  IntCmp $2 0 0 scien_ok scien_ok
     302  ${NSD_SetText} $Control2 "$(page_extensions_scientific_label_install)"
     303  scien_ok:
     304
     305  IntCmp $3 0 0 matp_ok matp_ok
     306  ${NSD_SetText} $Control3 "$(page_extensions_matplotlib_label_install)"
     307  matp_ok:
     308
     309  IntCmp $5 3 no_inst
     310  ${NSD_SetText} $Control4 "$(page_extensions_outro_install)"
     311  ${NSD_SetText} $Control0 "$(^InstallBtn)"
     312  no_inst:
     313 
     314  nsDialogs::Show
     315FunctionEnd
     316
     317Function LeaveExtensions
     318  IntCmp $5 0 +2
     319  Return
     320
     321  SetOutPath "${TemporaryFilesDir}"
     322 
     323  IntCmp $1 1 after_num
     324  File "${FileSource}\prereqs\${NumpyInst}"
     325  ExecWait '"${TemporaryFilesDir}\${NumpyInst}"'
     326  StrCpy $NumpyInst "1"
     327  after_num:
     328 
     329  StrCmp $2 1 after_scien
     330  File "${FileSource}\prereqs\${ScientificInst}"
     331  ExecWait '"${TemporaryFilesDir}\${ScientificInst}"'
     332  StrCpy $ScientificPythonInst "1"
     333  after_scien:
     334
     335  StrCmp $3 1 after_matp
     336  File "${FileSource}\prereqs\${MatplotlibInst}"
     337  ExecWait '"${TemporaryFilesDir}\${MatplotlibInst}"'
     338  StrCpy $MatplotlibInst "1"
     339  after_matp:
     340
     341FunctionEnd
     342
     343
     344Function EnterMinGW
     345# installbutton and directory selection
     346  !insertmacro MUI_HEADER_TEXT "$(page_mingw_title)" "$(page_mingw_subtitle)"
     347  nsDialogs::Create 1018
     348  Pop $Dialog
     349  StrCmp $Dialog "error" 0 +2
     350  Abort
     351  GetDlgItem $Control0 $HWNDPARENT 1
     352 
     353  ReadRegStr $MinGWDir HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW" "InstallLocation"
     354  IfFileExists "$MinGWDir\bin\gcc.exe" +2
     355  StrCpy $MinGWDir "C:\MinGW"
     356 
     357  ${NSD_CreateLabel} 10 10 430 28 "$(page_mingw_install_label)"
     358  ${NSD_CreateButton} 40 50 370 24 "$(page_mingw_install_button)"
     359  Pop $Control1
     360  ${NSD_CreateLabel} 10 100 430 28 "$(page_mingw_browse_label)"
     361  ${NSD_CreateDirRequest} 40 140 290 24 "$MinGWDir"
     362  Pop $Control2
     363  ${NSD_CreateButton} 340 140 70 24 "$(page_mingw_browse_button)"
     364  Pop $Control3
     365  ${NSD_CreateLabel} 10 190 430 28 "$(page_mingw_outro)"
     366 
     367  ${NSD_OnClick} $Control1 RunMinGWSetup
     368  ${NSD_OnChange} $Control2 ValidateMinGWDir
     369  ${NSD_OnClick} $Control3 BrowseMinGWDir
     370 
     371  Call ValidateMinGWDir
     372  nsDialogs::Show
     373FunctionEnd
     374
     375Function RunMinGWSetup
     376  SetOutPath "${TemporaryFilesDir}"
     377  File "${FileSource}\prereqs\${MinGWInst}"
     378  ExecWait '"${TemporaryFilesDir}\${MinGWInst}"'
     379  StrCpy $MinGWInst "1"
     380  Call ValidateMinGWDir
     381FunctionEnd
     382
     383Function BrowseMinGWDir
     384  nsDialogs::SelectFolderDialog "$(page_mingw_browse_dialog_title)" $MinGWDir
     385  Pop $0
     386  StrCmp $0 "error" 0 +2
     387  Return
     388  ${NSD_SetText} $Control2 $0
     389  Call ValidateMinGWDir
     390FunctionEnd
     391
     392Function ValidateMinGWDir
     393  ${NSD_GetText} $Control2 $MinGWDir
     394  IfFileExists "$MinGWDir\bin\gcc.exe" ok
     395 
     396  EnableWindow $Control0 0
     397  Return
     398  ok:
     399  EnableWindow $Control0 1
     400 
     401  #Add the MingW\bin path to the envorinment variables
     402  #${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$MinGWDir\bin"
     403FunctionEnd
    143404
    144405Section -uninst_registry
     
    161422  WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "PythonInstalled" $PythonInst
    162423  WriteRegStr HKLM "SOFTWARE\${ProductName}" "PythonDir" $PythonDir
    163   WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "ScientificPythonInstalled" ""
    164   WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "NumericPythonInstalled" ""
    165   WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "MatplotlibInstalled" ""
    166   WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "MinGWInstalled" "$MinGWInst"
     424  WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "ScientificPythonInstalled" $ScientificPythonInst
     425  WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "NumpyInstalled" $NumpyInst
     426  WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "MatplotlibInstalled" $MatplotlibInst
     427  WriteRegDWORD HKLM "SOFTWARE\${ProductName}" "MinGWInstalled" $MinGWInst
    167428  WriteRegStr HKLM "SOFTWARE\${ProductName}" "MinGWDir" "$MinGWDir"
    168429  WriteRegStr HKLM "SOFTWARE\${ProductName}" "NetCDFDir" "$NetCDFDir"
    169430SectionEnd
    170 
    171 
    172 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
    173   !insertmacro MUI_DESCRIPTION_TEXT ${sec_ncdf} $(description_netcdf)
    174   !insertmacro MUI_DESCRIPTION_TEXT ${sec_install} $(description_anuga_install)
    175   !insertmacro MUI_DESCRIPTION_TEXT ${sec_test} $(description_anuga_test)
    176   !insertmacro MUI_DESCRIPTION_TEXT ${sec_validate} $(description_anuga_validate)
    177   !insertmacro MUI_DESCRIPTION_TEXT ${sec_viewer} $(description_anuga_viewer)
    178   !insertmacro MUI_DESCRIPTION_TEXT ${sec_ext} $(description_anuga_viewer_extension)
    179 !insertmacro MUI_FUNCTION_DESCRIPTION_END
    180 
    181 # function executed on initialization of the installer
    182 Function .onInit
    183     # prevent the installer from beeing executed twice a time
    184     System::Call "kernel32::CreateMutexA(i 0, i 0, t '$(^Name)') i .n ?e" # create a mutex
    185     Pop $0
    186     StrCmp $0 0 0 find
    187   Return # launch normaly if mutex could be created = no other instance running
    188  
    189   find:
    190     StrLen $0 "$(^Name)"
    191     IntOp $0 $0 + 1 
    192   loop:
    193     FindWindow $1 '#32770' '' 0 $1 # search the installers window if another instance is already running
    194     IntCmp $1 0 +4
    195     System::Call /NOUNLOAD "user32.dll::GetWindowText(i r1, t .r2, i r0) i.n"
    196     StrCmp $2 "$(^Name)" 0 loop # check back for correct window text
    197     System::Call "user32::SetForegroundWindow(i r1) i.n" # bring it to front if found
    198   Abort # then exit
    199 FunctionEnd
    200 
    201 
    202 Function .onGUIEnd
    203   RMDir /r "${TemporaryFilesDir}"
    204 FunctionEnd
    205 
    206 
    207 Function EnterPython
    208 # installbutton and directory selection
    209   !insertmacro MUI_HEADER_TEXT "$(page_python_title)" "$(page_python_subtitle)"
    210   nsDialogs::Create 1018
    211   Pop $Dialog
    212   StrCmp $Dialog "error" 0 +2
    213   Abort
    214   GetDlgItem $Control0 $HWNDPARENT 1
    215  
    216   # get python directory
    217   ReadRegStr $PythonDir HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" ""
    218   StrLen $0 $PythonDir
    219   IntOp $0 $0 - 10
    220   StrCpy $PythonDir $PythonDir $0
    221  
    222   # select default, if possible from registry
    223   IfFileExists "$PythonDir\python.exe" +2
    224   StrCpy $PythonDir "C:\Python25"
    225  
    226   # create dialog items
    227   ${NSD_CreateLabel} 10 10 430 28 "$(page_python_install_label)"
    228   ${NSD_CreateButton} 40 50 370 24 "$(page_python_install_button)"
    229   Pop $Control1
    230   ${NSD_CreateLabel} 10 100 430 28 "$(page_python_browse_label)"
    231   ${NSD_CreateDirRequest} 40 140 290 24 "$PythonDir"
    232   Pop $Control2
    233   ${NSD_CreateButton} 340 140 70 24 "$(page_python_browse_button)"
    234   Pop $Control3
    235   ${NSD_CreateLabel} 10 190 430 28 "$(page_python_outro)"
    236  
    237   # register dialog actions
    238   ${NSD_OnClick} $Control1 RunPythonSetup
    239   ${NSD_OnChange} $Control2 ValidatePythonDir
    240   ${NSD_OnClick} $Control3 BrowsePythonDir
    241  
    242   # check for valid python directory
    243   Call ValidatePythonDir
    244  
    245   # show the page
    246   nsDialogs::Show
    247 FunctionEnd
    248 
    249 # extract and run the python installer
    250 Function RunPythonSetup
    251   SetOutPath "${TemporaryFilesDir}"
    252   File "${FileSource}\prereqs\${PythonInst}"
    253   ExecShell "" '"${TemporaryFilesDir}\${PythonInst}"'
    254   StrCpy $PythonInst "1"
    255   EnableWindow $Control0 1 # enable next button
    256 FunctionEnd
    257 
    258 # browse for the python dir with a folder dialog
    259 Function BrowsePythonDir
    260   nsDialogs::SelectFolderDialog "$(page_python_browse_dialog_title)" $PythonDir
    261   Pop $0
    262   StrCmp $0 "error" 0 +2
    263   Return
    264   ${NSD_SetText} $Control2 $0
    265   Call ValidatePythonDir
    266 FunctionEnd
    267 
    268 # enable next button if selected python dir is valid
    269 Function ValidatePythonDir
    270   ${NSD_GetText} $Control2 $PythonDir
    271   IfFileExists "$PythonDir\python.exe" ok
    272  
    273   EnableWindow $Control0 0
    274   Return
    275   ok:
    276   EnableWindow $Control0 1
    277 FunctionEnd
    278 
    279 
    280 Function EnterExtensions
    281 # installbuttons for missing extensions
    282   !insertmacro MUI_HEADER_TEXT "$(page_extensions_title)" "$(page_extensions_subtitle)"
    283   nsDialogs::Create 1018
    284   Pop $Dialog
    285   StrCmp $Dialog "error" 0 +2
    286   Abort
    287   GetDlgItem $Control0 $HWNDPARENT 1
    288  
    289   ${NSD_CreateLabel} 10 10 430 28 "$(page_extensions_intro)"
    290   ${NSD_CreateLabel} 40 50 350 28 "$(page_extensions_numpy_ok)"
    291   Pop $Control1
    292   ${NSD_CreateLabel} 40 100 350 28 "$(page_extensions_scientific_ok)"
    293   Pop $Control2
    294   ${NSD_CreateLabel} 40 150 350 28 "$(page_extensions_matplotlib_ok)"
    295   Pop $Control3
    296   ${NSD_CreateLabel} 10 190 430 28 "$(page_extensions_outro_next)"
    297   Pop $Control4
    298  
    299   StrCpy $1 "0"
    300   StrCpy $2 "0"
    301   StrCpy $3 "0"
    302   StrCpy $4 "0"
    303   StrCpy $5 "0"
    304   IfFileExists "$PackagesDir\Numpy\*.py" 0 +2
    305   IntOp $1 $1 + 1
    306   IfFileExists "$PackagesDir\Scientific\*.py" 0 +2
    307   IntOp $2 $2 + 1
    308   IfFileExists "$PackagesDir\matplotlib\*.py" 0 +2
    309   IntOp $3 $3 + 1
    310   IntOp $4 $2 + $1
    311   IntOp $5 $4 + $3
    312  
    313   IntCmp $1 0 0 num_ok num_ok
    314   ${NSD_SetText} $Control1 "$(page_extensions_numpy_label_install)"
    315   num_ok:
    316  
    317   IntCmp $2 0 0 scien_ok scien_ok
    318   ${NSD_SetText} $Control2 "$(page_extensions_scientific_label_install)"
    319   scien_ok:
    320 
    321   IntCmp $3 0 0 matp_ok matp_ok
    322   ${NSD_SetText} $Control3 "$(page_extensions_matplotlib_label_install)"
    323   matp_ok:
    324 
    325   IntCmp $5 3 no_inst
    326   ${NSD_SetText} $Control4 "$(page_extensions_outro_install)"
    327   ${NSD_SetText} $Control0 "$(^InstallBtn)"
    328   no_inst:
    329  
    330   nsDialogs::Show
    331 FunctionEnd
    332 
    333 Function LeaveExtensions
    334   IntCmp $5 0 +2
    335   Return
    336 
    337   SetOutPath "${TemporaryFilesDir}"
    338  
    339   IntCmp $1 1 after_num
    340   File "${FileSource}\prereqs\${NumpyInst}"
    341   ExecWait '"${TemporaryFilesDir}\${NumpyInst}"'
    342   after_num:
    343  
    344   StrCmp $2 1 after_scien
    345   File "${FileSource}\prereqs\${ScientificInst}"
    346   ExecWait '"${TemporaryFilesDir}\${ScientificInst}"'
    347   after_scien:
    348 
    349   StrCmp $3 1 after_matp
    350   File "${FileSource}\prereqs\${MatplotlibInst}"
    351   ExecWait '"${TemporaryFilesDir}\${MatplotlibInst}"'
    352   after_matp:
    353 
    354 FunctionEnd
    355 
    356 
    357 Function EnterMinGW
    358 # installbutton and directory selection
    359   !insertmacro MUI_HEADER_TEXT "$(page_mingw_title)" "$(page_mingw_subtitle)"
    360   nsDialogs::Create 1018
    361   Pop $Dialog
    362   StrCmp $Dialog "error" 0 +2
    363   Abort
    364   GetDlgItem $Control0 $HWNDPARENT 1
    365  
    366   ReadRegStr $MinGWDir HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW" "InstallLocation"
    367   IfFileExists "$MinGWDir\bin\gcc.exe" +2
    368   StrCpy $MinGWDir "C:\MinGW"
    369  
    370   ${NSD_CreateLabel} 10 10 430 28 "$(page_mingw_install_label)"
    371   ${NSD_CreateButton} 40 50 370 24 "$(page_mingw_install_button)"
    372   Pop $Control1
    373   ${NSD_CreateLabel} 10 100 430 28 "$(page_mingw_browse_label)"
    374   ${NSD_CreateDirRequest} 40 140 290 24 "$MinGWDir"
    375   Pop $Control2
    376   ${NSD_CreateButton} 340 140 70 24 "$(page_mingw_browse_button)"
    377   Pop $Control3
    378   ${NSD_CreateLabel} 10 190 430 28 "$(page_mingw_outro)"
    379  
    380   ${NSD_OnClick} $Control1 RunMinGWSetup
    381   ${NSD_OnChange} $Control2 ValidateMinGWDir
    382   ${NSD_OnClick} $Control3 BrowseMinGWDir
    383  
    384   Call ValidateMinGWDir
    385   nsDialogs::Show
    386 FunctionEnd
    387 
    388 Function RunMinGWSetup
    389   SetOutPath "${TemporaryFilesDir}"
    390   File "${FileSource}\prereqs\${MinGWInst}"
    391   ExecWait '"${TemporaryFilesDir}\${MinGWInst}"'
    392   StrCpy $MinGWInst "1"
    393   Call ValidateMinGWDir
    394 FunctionEnd
    395 
    396 Function BrowseMinGWDir
    397   nsDialogs::SelectFolderDialog "$(page_mingw_browse_dialog_title)" $MinGWDir
    398   Pop $0
    399   StrCmp $0 "error" 0 +2
    400   Return
    401   ${NSD_SetText} $Control2 $0
    402   Call ValidateMinGWDir
    403 FunctionEnd
    404 
    405 Function ValidateMinGWDir
    406   ${NSD_GetText} $Control2 $MinGWDir
    407   IfFileExists "$MinGWDir\bin\gcc.exe" ok
    408  
    409   EnableWindow $Control0 0
    410   Return
    411   ok:
    412   EnableWindow $Control0 1
    413  
    414   #Add the MingW\bin path to the envorinment variables
    415   ${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$MinGWDir\bin"
    416 FunctionEnd
    417431
    418432
     
    420434Section "un.install"
    421435  #Remove the MingW\bin path from the envorinment variables
     436  ReadRegStr $PythonDir HKEY_LOCAL_MACHINE "SOFTWARE\${ProductName}" "PythonDir"
     437  ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$PythonDir"
     438  ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$PythonDir\DLLs"
     439  ReadRegStr $NetCDFDir HKEY_LOCAL_MACHINE "SOFTWARE\${ProductName}" "NetCDFDir"
     440  ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$NetCDFDir"
    422441  ReadRegStr $MinGWDir HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW" "InstallLocation"
    423   ${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$MinGWDir\bin"
     442  ${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$MinGWDir\bin"
    424443 
    425444  ReadRegStr $INSTDIR HKLM "SOFTWARE\${ProductName}" "PythonDir"
Note: See TracChangeset for help on using the changeset viewer.