4 |
;-------------------------------- |
;-------------------------------- |
5 |
|
|
6 |
; The name of the installer |
; The name of the installer |
7 |
Name "ASCEND" |
|
8 |
|
!ifndef VERSION |
9 |
|
!define VERSION 0.svn |
10 |
|
!endif |
11 |
|
|
12 |
|
Name "ASCEND ${VERSION}" |
13 |
|
|
14 |
!include LogicLib.nsh |
!include LogicLib.nsh |
15 |
|
|
16 |
|
!ifndef PYVERSION |
17 |
|
!define PYVERSION "2.5" |
18 |
|
!endif |
19 |
|
|
20 |
; The file to write |
; The file to write |
21 |
!ifdef OUTFILE |
!ifdef OUTFILE |
22 |
OutFile ${OUTFILE}.exe |
OutFile ${OUTFILE} |
23 |
!else |
!else |
24 |
OutFile ascend-setup.exe |
OutFile "ascend-${VERSION}-py${PYVERSION}.exe" |
25 |
!endif |
!endif |
26 |
|
|
|
|
|
27 |
SetCompressor /FINAL zlib |
SetCompressor /FINAL zlib |
28 |
;SetCompressor /SOLID lzma |
;SetCompressor /SOLID lzma |
29 |
|
|
53 |
Var /GLOBAL GTKOK |
Var /GLOBAL GTKOK |
54 |
Var /GLOBAL GTKPATH |
Var /GLOBAL GTKPATH |
55 |
Var /GLOBAL GLADEOK |
Var /GLOBAL GLADEOK |
56 |
|
Var /GLOBAL PYGTKOK |
57 |
|
Var /GLOBAL PYGOBJECTOK |
58 |
|
Var /GLOBAL PYCAIROOK |
59 |
Var /GLOBAL GLADEPATH |
Var /GLOBAL GLADEPATH |
60 |
Var /GLOBAL PYINSTALLED |
Var /GLOBAL PYINSTALLED |
61 |
Var /GLOBAL TCLOK |
Var /GLOBAL TCLOK |
83 |
|
|
84 |
Call DetectTcl |
Call DetectTcl |
85 |
Pop $TCLOK |
Pop $TCLOK |
86 |
Pop $TCLPATH |
Pop $TCLPATH |
87 |
|
|
88 |
|
Call DetectPyGTK |
89 |
|
Pop $PYGTKOK |
90 |
|
|
91 |
|
Call DetectPyGObject |
92 |
|
Pop $PYGOBJECTOK |
93 |
|
|
94 |
|
Call DetectPyCairo |
95 |
|
Pop $PYCAIROOK |
96 |
|
|
97 |
StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH" |
StrCpy $PATH "$DEFAULTPATH;$PYPATH;$GTKPATH" |
98 |
|
|
110 |
File "ascend.dll" |
File "ascend.dll" |
111 |
File "ascend-config" |
File "ascend-config" |
112 |
File "pygtk\glade\ascend.ico" |
File "pygtk\glade\ascend.ico" |
113 |
|
File "LICENSE.txt" |
114 |
|
File "CHANGELOG.txt" |
115 |
|
|
116 |
; Model Library |
; Model Library |
117 |
SetOutPath $INSTDIR\models |
SetOutPath $INSTDIR\models |
182 |
;-------------------------------- |
;-------------------------------- |
183 |
|
|
184 |
Section "PyGTK GUI" |
Section "PyGTK GUI" |
185 |
${If} $PYOK == 'OK' |
; Check the dependencies of the PyGTK GUI before proceding... |
186 |
${If} $GTKOK == 'OK' |
${If} $PYOK == 'NOK' |
187 |
${If} $GLADEOK == 'OK' |
MessageBox MB_OK "PyGTK GUI can not be installed, because Python was not found on this system.$\nIf you do want to use the PyGTK GUI, please check the installation instructions$\n$\n(PYPATH=$PYPATH)" |
188 |
;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH" |
${ElseIf} $GTKOK == 'NOK' |
189 |
|
MessageBox MB_OK "PyGTK GUI cannot be installed, because GTK+ 2.x was not found on this system.$\nIf you do want to use the PyGTK GUI, please check the installation instructions$\n$\n(GTKPATH=$GTKPATH)" |
190 |
DetailPrint "--- PYTHON INTERFACE ---" |
${ElseIf} $GLADEOK == 'NOK' |
191 |
|
MessageBox MB_OK "PyGTK GUI cannot be installed, because Glade 2.x was not found on this system.$\nIf you do want to use the PyGTK GUI, please check the installation instructions$\n$\n(GTKPATH=$GTKPATH)" |
192 |
; Set output path to the installation directory. |
${ElseIf} $PYGTKOK == "NOK" |
193 |
SetOutPath $INSTDIR |
MessageBox MB_OK "PyGTK GUI cannot be installed, because PyGTK was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)" |
194 |
|
${ElseIf} $PYCAIROOK == "NOK" |
195 |
; Python interface |
MessageBox MB_OK "PyGTK GUI cannot be installed, because PyCairo was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)" |
196 |
File "pygtk\_ascpy.dll" |
${ElseIf} $PYGOBJECTOK == "NOK" |
197 |
File "pygtk\*.py" |
MessageBox MB_OK "PyGTK GUI cannot be installed, because PyGObject was not found on this system.$\nPlease check the installation instructions.$\n$\n(PYPATH=$PYPATH)" |
198 |
File "pygtk\ascend" |
${Else} |
199 |
File "pygtk\glade\ascend-doc.ico" |
;MessageBox MB_OK "Python: $PYPATH, GTK: $GTKPATH" |
|
|
|
|
SetOutPath $INSTDIR\glade |
|
|
File "pygtk\glade\*.glade" |
|
|
File "pygtk\glade\*.png" |
|
|
File "pygtk\glade\*.svg" |
|
|
|
|
|
StrCpy $PYINSTALLED "1" |
|
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1 |
|
|
|
|
|
;---- file association ---- |
|
|
|
|
|
; back up old value of .a4c file association |
|
|
ReadRegStr $1 HKCR ".a4c" "" |
|
|
StrCmp $1 "" a4cnobkp |
|
|
StrCmp $1 "ASCEND.model" a4cnobkp |
|
200 |
|
|
201 |
; Remember the old file association if necessary |
DetailPrint "--- PYTHON INTERFACE ---" |
202 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1 |
|
203 |
|
; Set output path to the installation directory. |
204 |
|
SetOutPath $INSTDIR |
205 |
|
|
206 |
|
; Python interface |
207 |
|
File "pygtk\_ascpy.pyd" |
208 |
|
File "pygtk\*.py" |
209 |
|
File "pygtk\ascend" |
210 |
|
File "pygtk\glade\ascend-doc.ico" |
211 |
|
|
212 |
|
SetOutPath $INSTDIR\glade |
213 |
|
File "pygtk\glade\*.glade" |
214 |
|
File "pygtk\glade\*.png" |
215 |
|
File "pygtk\glade\*.svg" |
216 |
|
|
217 |
|
StrCpy $PYINSTALLED "1" |
218 |
|
WriteRegDWORD HKLM "SOFTWARE\ASCEND" "Python" 1 |
219 |
|
|
220 |
|
;---- file association ---- |
221 |
|
|
222 |
|
; back up old value of .a4c file association |
223 |
|
ReadRegStr $1 HKCR ".a4c" "" |
224 |
|
StrCmp $1 "" a4cnobkp |
225 |
|
StrCmp $1 "ASCEND.model" a4cnobkp |
226 |
|
|
227 |
|
; Remember the old file association if necessary |
228 |
|
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4C" $1 |
229 |
|
|
230 |
a4cnobkp: |
a4cnobkp: |
231 |
WriteRegStr HKCR ".a4c" "" "ASCEND.model" |
WriteRegStr HKCR ".a4c" "" "ASCEND.model" |
232 |
|
|
233 |
; back up old value of .a4c file association |
; back up old value of .a4c file association |
234 |
ReadRegStr $1 HKCR ".a4l" "" |
ReadRegStr $1 HKCR ".a4l" "" |
235 |
StrCmp $1 "" a4lnobkp |
StrCmp $1 "" a4lnobkp |
236 |
StrCmp $1 "ASCEND.model" a4lnobkp |
StrCmp $1 "ASCEND.model" a4lnobkp |
237 |
|
|
238 |
; Remember the old file association if necessary |
; Remember the old file association if necessary |
239 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1 |
WriteRegStr HKLM "SOFTWARE\ASCEND" "BackupAssocA4L" $1 |
240 |
|
|
241 |
a4lnobkp: |
a4lnobkp: |
242 |
WriteRegStr HKCR ".a4l" "" "ASCEND.model" |
WriteRegStr HKCR ".a4l" "" "ASCEND.model" |
243 |
|
|
244 |
|
; So, what does an A4L or A4C file actually do? |
245 |
|
|
246 |
|
ReadRegStr $0 HKCR "ASCEND.model" "" |
247 |
|
StrCmp $0 "" 0 a4cskip |
248 |
|
|
249 |
; So, what does an A4L or A4C file actually do? |
WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file" |
250 |
|
WriteRegStr HKCR "ASCEND.model\shell" "" "open" |
251 |
ReadRegStr $0 HKCR "ASCEND.model" "" |
WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico" |
|
StrCmp $0 "" 0 a4cskip |
|
|
|
|
|
WriteRegStr HKCR "ASCEND.model" "" "ASCEND model file" |
|
|
WriteRegStr HKCR "ASCEND.model\shell" "" "open" |
|
|
WriteRegStr HKCR "ASCEND.model\DefaultIcon" "" "$INSTDIR\ascend-doc.ico" |
|
252 |
|
|
253 |
a4cskip: |
a4cskip: |
254 |
WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw "$INSTDIR\ascend" "%1"' |
WriteRegStr HKCR "ASCEND.model\shell\open\command" "" '$PYPATH\pythonw "$INSTDIR\ascend" "%1"' |
255 |
|
|
256 |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)' |
257 |
|
|
|
${Else} |
|
|
MessageBox MB_OK "PyGTK GUI can not be installed, because Glade was not found on this system. If you do want to use the PyGTK GUI, please check the installation instructions ($GLADEPATH)" |
|
|
${EndIf} |
|
|
${Else} |
|
|
MessageBox MB_OK "PyGTK GUI can not be installed, because GTK+ 2.0 was not found on this system. If you do want to use the PyGTK GUI, please check the installation instructions ($GTKPATH)" |
|
|
${EndIf} |
|
|
${Else} |
|
|
MessageBox MB_OK "PyGTK GUI can not be installed, because Python was not found on this system. If you do want to use the PyGTK GUI, please check the installation instructions ($PYPATH)" |
|
258 |
${EndIf} |
${EndIf} |
259 |
Return |
Return |
260 |
|
|
304 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
305 |
smnotcl: |
smnotcl: |
306 |
|
|
307 |
|
; Information files |
308 |
|
CreateShortCut "$SMPROGRAMS\ASCEND\LICENSE.txt.lnk" "$INSTDIR\LICENSE.txt" '' "$INSTDIR\LICENSE.txt" 0 |
309 |
|
CreateShortCut "$SMPROGRAMS\ASCEND\CHANGELOG.txt.lnk" "$INSTDIR\CHANGELOG.txt" '' "$INSTDIR\CHANGELOG.txt" 0 |
310 |
|
|
311 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
312 |
|
|
313 |
SectionEnd |
SectionEnd |
324 |
|
|
325 |
unpython: |
unpython: |
326 |
DetailPrint "--- REMOVING PYTHON COMPONENTS ---" |
DetailPrint "--- REMOVING PYTHON COMPONENTS ---" |
327 |
Delete $INSTDIR\_ascpy.dll |
Delete $INSTDIR\_ascpy.pyd |
328 |
Delete $INSTDIR\ascend |
Delete $INSTDIR\ascend |
329 |
Delete $INSTDIR\*.py |
Delete $INSTDIR\*.py |
330 |
Delete $INSTDIR\*.pyc |
Delete $INSTDIR\*.pyc |
403 |
Delete $INSTDIR\ascend-config |
Delete $INSTDIR\ascend-config |
404 |
Delete $INSTDIR\ascend-config.bat |
Delete $INSTDIR\ascend-config.bat |
405 |
Delete $INSTDIR\ascend.dll |
Delete $INSTDIR\ascend.dll |
406 |
|
Delete $INSTDIR\LICENSE.txt |
407 |
|
Delete $INSTDIR\CHANGELOG.txt |
408 |
Delete $INSTDIR\ascend.ico |
Delete $INSTDIR\ascend.ico |
409 |
Delete $INSTDIR\Makefile.bt |
Delete $INSTDIR\Makefile.bt |
410 |
Delete $INSTDIR\ascend.syn |
Delete $INSTDIR\ascend.syn |
421 |
; UTILITY ROUTINES |
; UTILITY ROUTINES |
422 |
|
|
423 |
Function DetectPython |
Function DetectPython |
424 |
ReadRegStr $R6 HKCU "SOFTWARE\Python\PythonCore\2.4\InstallPath" "" |
ReadRegStr $R6 HKCU "SOFTWARE\Python\PythonCore\${PYVERSION}\InstallPath" "" |
425 |
${If} $R6 == '' |
${If} $R6 == '' |
426 |
ReadRegStr $R6 HKLM "SOFTWARE\Python\PythonCore\2.4\InstallPath" "" |
ReadRegStr $R6 HKLM "SOFTWARE\Python\PythonCore\${PYVERSION}\InstallPath" "" |
427 |
${If} $R6 == '' |
${If} $R6 == '' |
428 |
Push "No registry key found" |
Push "No registry key found" |
429 |
Push "NOK" |
Push "NOK" |
462 |
Push "NOK" |
Push "NOK" |
463 |
${EndIf} |
${EndIf} |
464 |
FunctionEnd |
FunctionEnd |
465 |
|
|
466 |
|
;-------------------------------------------------------------------- |
467 |
|
; Are necessary PyGTK bits and pieces available? |
468 |
|
|
469 |
|
Function DetectPyGTK |
470 |
|
${If} ${FileExists} "$PYPATH\Lib\site-packages\gtk-2.0\gtk\__init__.py" |
471 |
|
Push "OK" |
472 |
|
${Else} |
473 |
|
Push "NOK" |
474 |
|
${EndIf} |
475 |
|
FunctionEnd |
476 |
|
|
477 |
|
Function DetectPyCairo |
478 |
|
${If} ${FileExists} "$PYPATH\Lib\site-packages\cairo\__init__.py" |
479 |
|
Push "OK" |
480 |
|
${Else} |
481 |
|
Push "NOK" |
482 |
|
${EndIf} |
483 |
|
FunctionEnd |
484 |
|
|
485 |
|
Function DetectPyGObject |
486 |
|
${If} ${FileExists} "$PYPATH\Lib\site-packages\gtk-2.0\gobject\__init__.py" |
487 |
|
Push "OK" |
488 |
|
${Else} |
489 |
|
Push "NOK" |
490 |
|
${EndIf} |
491 |
|
FunctionEnd |
492 |
|
|
493 |
;-------------------------------------------------------------------- |
;-------------------------------------------------------------------- |
494 |
; Prefer the current user's installation of GTK, fall back to the local machine |
; Prefer the current user's installation of GTK, fall back to the local machine |