source: orange/install-scripts/install3.nsi @ 11086:858171f81702

Revision 11086:858171f81702, 8.5 KB checked in by markotoplak, 15 months ago (diff)

Removed links to obsolete and now gone documentation from the Windows package.

RevLine 
[604]1Name "Orange"
[898]2Icon OrangeInstall.ico
3UninstallIcon OrangeInstall.ico
[6255]4licensedata license.txt
5licensetext "Acknowledgments and License Agreement"
[3113]6
[3121]7OutFile ${OUTFILENAME}
[2910]8
[604]9!include "LogicLib.nsh"
10
[6255]11!ifdef COMPLETE
12    !macro installmodule modulename installfile checkfile
13        ${Unless} ${FileExists} ${checkfile}
14            File ${PARTY}\${installfile}
15            ExecWait $DESKTOP\${installfile}
16            Delete $DESKTOP\${installfile}
17        ${EndUnless}
18    !macroend
19!else
20    Var MissingModules
21    !macro installmodule modulename installfile checkfile
22        ${Unless} ${FileExists} ${checkfile}
23        ${AndUnless} modulename == ""
24            ${If} $MissingModules == ""
[6271]25                StrCpy $MissingModules ${modulename}
[6255]26            ${Else}
[6271]27                StrCpy $MissingModules "$MissingModules, ${modulename}"
[6255]28            ${EndIf}
29        ${EndUnless}
30    !macroend
31!endif
32
[6271]33!include "${PARTY}\names.inc"
[604]34
35AutoCloseWindow true
36ShowInstDetails nevershow
37
38Var PythonDir
[3121]39Var AdminInstall
[10215]40Var SITEDIR
[604]41
42Page license
[3123]43Page instfiles
[604]44
[3644]45!define SHELLFOLDERS \
46  "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"
47 
48
[604]49Section Uninstall
[3123]50    MessageBox MB_YESNO "Are you sure you want to remove Orange?$\r$\n$\r$\nThis won't remove any 3rd party software possibly installed with Orange, such as Python or Qt,$\r$\n$\r$\nbut make sure you have not left any of your files in Orange's directories!" /SD IDYES IDNO abort
[604]51    RmDir /R "$INSTDIR"
[3121]52    ${If} $AdminInstall = 0
[1925]53        SetShellVarContext all
54    ${Else}
55        SetShellVarContext current     
56    ${Endif}
[604]57    RmDir /R "$SMPROGRAMS\Orange"
[3644]58
59    ReadRegStr $0 HKCU "${SHELLFOLDERS}" AppData
60    StrCmp $0 "" 0 +2
61      ReadRegStr $0 HKLM "${SHELLFOLDERS}" "Common AppData"
62    StrCmp $0 "" +2 0
63      RmDir /R "$0\Orange"
[1098]64   
[3113]65    ReadRegStr $PythonDir HKLM Software\Python\PythonCore\${NPYVER}\InstallPath ""
[1805]66    ${If} $PythonDir != ""
[3113]67        DeleteRegKey HKLM "SOFTWARE\Python\PythonCore\${NPYVER}\PythonPath\Orange"
[1098]68        DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Orange"
69    ${Else}
[3113]70        DeleteRegKey HKCU "SOFTWARE\Python\PythonCore\${NPYVER}\PythonPath\Orange"
[1098]71        DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Orange"
72    ${Endif}
73   
[898]74    Delete "$DESKTOP\Orange Canvas.lnk"
75
76    DeleteRegKey HKEY_CLASSES_ROOT ".ows"
77    DeleteRegKey HKEY_CLASSES_ROOT "OrangeCanvas"
78
[3123]79    MessageBox MB_OK "Orange has been succesfully removed from your system.$\r$\nPython and other applications need to be removed separately.$\r$\n$\r$\nYou may now continue without rebooting your machine." /SD IDOK
[604]80  abort:
81SectionEnd
82
83
[3121]84!macro GetPythonDir
85    ${If} $AdminInstall == 0
86        ReadRegStr $PythonDir HKCU Software\Python\PythonCore\${NPYVER}\InstallPath ""
87        StrCmp $PythonDir "" 0 trim_backslash
88        ReadRegStr $PythonDir HKLM Software\Python\PythonCore\${NPYVER}\InstallPath ""
89        StrCmp $PythonDir "" return
[3123]90        MessageBox MB_OK "Please ask the administrator to install Orange$\r$\n(this is because Python was installed by him, too)."
[3121]91        Quit
92    ${Else}
93        ReadRegStr $PythonDir HKLM Software\Python\PythonCore\${NPYVER}\InstallPath ""
94        StrCmp $PythonDir "" 0 trim_backslash
95        ReadRegStr $PythonDir HKCU Software\Python\PythonCore\${NPYVER}\InstallPath ""
96        StrCmp $PythonDir "" return
97        StrCpy $AdminInstall 0
[3123]98    ${EndIf}
[604]99
[3121]100    trim_backslash:
[3113]101    StrCpy $0 $PythonDir "" -1
102    ${If} $0 == "\"
103        StrLen $0 $PythonDir
104        IntOp $0 $0 - 1
105        StrCpy $PythonDir $PythonDir $0 0
106    ${EndIf}
[627]107
[3121]108    return:
109!macroend
110       
[3123]111!ifdef COMPLETE
[3641]112
[3123]113Section ""
[3121]114        StrCmp $PythonDir "" 0 have_python
[4594]115
[3113]116        SetOutPath $DESKTOP
[6255]117        StrCpy $0 ""
118        askpython:
119            MessageBox MB_YESNOCANCEL "Orange installer will first launch installation of Python ${NPYVER}.$\r$\nWould you like it to install automatically?$\r$\n(Press No for Custom installation of Python, Cancel to cancel installation of Orange." /SD IDYES IDYES installsilently IDNO installpython
120                MessageBox MB_YESNO "Orange cannot run without Python.$\r$\nAbort the installation?" IDNO askpython
121                    Quit
122        installsilently:
123            StrCpy $0 "/Qb-"
124        installpython:
125            File ${PARTY}\${NAME_PYTHON}
126            ${If} $AdminInstall == 1
[6271]127                ExecWait 'msiexec.exe /i "$DESKTOP\${NAME_PYTHON}" ALLUSERS=1 $0' $0
[6255]128            ${Else}
[6271]129                ExecWait 'msiexec.exe /i "$DESKTOP\${NAME_PYTHON}" $0' $0
[6255]130            ${EndIf}
131            Delete "$DESKTOP\${NAME_PYTHON}"
132       
133            !insertMacro GetPythonDir
134            StrCmp $PythonDir "" 0 have_python
135                MessageBox MB_OK "Python installation failed.$\r$\nOrange installation cannot continue."
136                Quit
[4594]137
[6255]138        have_python:
[3121]139
140        IfFileExists $PythonDir\lib\site-packages\PythonWin have_pythonwin
141            MessageBox MB_YESNO "Do you want to install PythonWin (recommended)?$\r$\n(Orange installation will continue afterwards.)" /SD IDYES IDNO have_pythonwin
[6255]142            IfFileExists "$SysDir\${NAME_MFC}" have_mfc
[3640]143                SetOutPath $SysDir
[6255]144                File ${PARTY}\${NAME_MFC}
[3640]145            have_mfc:
[3121]146            SetOutPath $DESKTOP
[6255]147            File ${PARTY}\${NAME_PYTHONWIN}
148            ExecWait "$DESKTOP\${NAME_PYTHONWIN}"
149            Delete "$DESKTOP\${NAME_PYTHONWIN}"
150           
151        have_pythonwin:
[3121]152
[6255]153        MessageBox MB_OK "Installation will check for various needed libraries$\r$\nand launch their installers if needed."
154        SetOutPath $DESKTOP
155        !insertMacro modules
[3123]156SectionEnd
157!endif
[3121]158
159
[3123]160Section ""
[3644]161    ReadRegStr $0 HKCU "${SHELLFOLDERS}" AppData
162    StrCmp $0 "" 0 +2
163      ReadRegStr $0 HKLM "${SHELLFOLDERS}" "Common AppData"
[3645]164    StrCmp $0 "" not_installed_before 0
[3644]165
[3645]166    IfFileExists "$0\Orange" 0 not_installed_before
[3644]167        ask_remove_old:
[3647]168        MessageBox MB_YESNOCANCEL "Another version of Orange has been found on the computer.$\r$\nDo you want to keep the existing settings for canvas and widgets?$\r$\n$\r$\nYou can usually safely answer 'Yes'; in case of problems, re-run this installation." /SD IDYES IDYES not_installed_before IDNO remove_old_settings
[3644]169            MessageBox MB_YESNO "Abort the installation?" IDNO ask_remove_old
170                Quit
171
172        remove_old_settings:
173        RmDir /R "$0\Orange"
174
175    not_installed_before:
176
[10215]177    StrCpy $SITEDIR "$PythonDir\lib\site-packages"
178   
179    IfFileExists "$SITEDIR\orange\orngEnviron.py" 0 no_old_orange_conflict
180        Rename "$SITEDIR\orange" "$SITEDIR\orange-old-backup"
181       
182    no_old_orange_conflict:
[10911]183
184    SetOutPath "$SITEDIR\Orange.egg-info"
185    File /r "${ORANGEDIR}.egg-info\*"
[10215]186   
187    StrCpy $INSTDIR  "$PythonDir\lib\site-packages\Orange"
188    SetOutPath "$INSTDIR"
189    File /r /x .hg ${ORANGEDIR}\*
[3121]190
191    CreateDirectory "$SMPROGRAMS\Orange"
[11086]192    #CreateShortCut "$SMPROGRAMS\Orange\Orange for Beginners.lnk" "$INSTDIR\doc\ofb\default.htm"
193    #CreateShortCut "$SMPROGRAMS\Orange\Orange Modules Reference.lnk" "$INSTDIR\doc\modules\default.htm"
194    #CreateShortCut "$SMPROGRAMS\Orange\Orange Reference Guide.lnk" "$INSTDIR\doc\reference\default.htm"
[1475]195
[10214]196    CreateShortCut "$SMPROGRAMS\Orange\Orange.lnk" "$INSTDIR"
[3121]197    CreateShortCut "$SMPROGRAMS\Orange\Uninstall Orange.lnk" "$INSTDIR\uninst.exe"
[1475]198
[10215]199    SetOutPath $INSTDIR\OrangeCanvas
200    CreateShortCut "$DESKTOP\Orange Canvas.lnk" "$PythonDir\pythonw.exe" "$INSTDIR\OrangeCanvas\orngCanvas.pyw" $INSTDIR\OrangeCanvas\icons\orange.ico 0
201    CreateShortCut "$SMPROGRAMS\Orange\Orange Canvas.lnk" "$PythonDir\pythonw.exe" "$INSTDIR\OrangeCanvas\orngCanvas.pyw" $INSTDIR\OrangeCanvas\icons\orange.ico 0
[1098]202
[10215]203    WriteRegStr SHELL_CONTEXT "SOFTWARE\Python\PythonCore\${NPYVER}\PythonPath\Orange" "" "$INSTDIR\orng"
[3121]204    WriteRegStr SHELL_CONTEXT "Software\Microsoft\Windows\CurrentVersion\Uninstall\Orange" "DisplayName" "Orange (remove only)"
205    WriteRegStr SHELL_CONTEXT "Software\Microsoft\Windows\CurrentVersion\Uninstall\Orange" "UninstallString" '"$INSTDIR\uninst.exe"'
[1098]206
[3121]207    WriteRegStr HKEY_CLASSES_ROOT ".ows" "" "OrangeCanvas"
[10215]208    WriteRegStr HKEY_CLASSES_ROOT "OrangeCanvas\DefaultIcon" "" "$INSTDIR\OrangeCanvas\icons\OrangeOWS.ico"
209    WriteRegStr HKEY_CLASSES_ROOT "OrangeCanvas\Shell\Open\Command\" "" '$PythonDir\python.exe $INSTDIR\OrangeCanvas\orngCanvas.pyw "%1"'
[3121]210
211    WriteUninstaller "$INSTDIR\uninst.exe"
212
[3123]213SectionEnd 
214
215Function .onInit
216    StrCpy $AdminInstall 1
217
218    UserInfo::GetAccountType
219    Pop $1
220    SetShellVarContext all
221    ${If} $1 != "Admin"
222        SetShellVarContext current
223        StrCpy $AdminInstall 0
224    ${Else}
225        SetShellVarContext all
226        StrCpy $AdminInstall 1
227    ${EndIf}
228
229    !insertMacro GetPythonDir
230
231    !ifndef COMPLETE
232        StrCmp $PythonDir "" 0 have_python
[5224]233            MessageBox MB_OK "Please install Python first (www.python.org)$\r$\nor download Orange distribution that includes Python."
[3647]234            Quit
[3123]235        have_python:
236
[6255]237        !insertMacro modules
238        StrCmp $MissingModules "" continueinst
239            MessageBox MB_YESNO "Missing module(s): $MissingModules$\r$\n$\r$\nWithout these modules you can still scripts in Orange, but Orange Canvas will not work without them.$\r$\nYou can download and install them later or obtain the Orange installation that includes them.$\r$\n$\r$\nContinue with installation?" /SD IDYES IDYES continueinst
240            Quit
[3123]241
242        continueinst:
243    !endif
[604]244FunctionEnd
245
246
247Function .onInstSuccess
[3123]248    MessageBox MB_OK "Orange has been successfully installed." /SD IDOK
[1268]249FunctionEnd
Note: See TracBrowser for help on using the repository browser.