286.1.18
by Olivier Tilloy
License and copyright header in the installer script. |
1 |
; Copyright (C) 2010 Olivier Tilloy <olivier@tilloy.net>
|
2 |
;
|
|
3 |
; This program is free software: you can redistribute it and/or modify
|
|
4 |
; it under the terms of the GNU General Public License as published by
|
|
5 |
; the Free Software Foundation, either version 3 of the License, or
|
|
6 |
; (at your option) any later version.
|
|
7 |
;
|
|
8 |
; This program is distributed in the hope that it will be useful,
|
|
9 |
; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 |
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 |
; GNU General Public License for more details.
|
|
12 |
;
|
|
13 |
; You should have received a copy of the GNU General Public License
|
|
14 |
; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
15 |
||
16 |
; NSIS installer script for pyexiv2.
|
|
286.1.6
by Olivier Tilloy
Add an entry to uninstall pyexiv2 in "Add/Remove Programs". |
17 |
|
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
18 |
!include MUI.nsh
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
19 |
!include nsDialogs.nsh
|
20 |
!include LogicLib.nsh
|
|
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
21 |
|
348.1.1
by Olivier Tilloy
Bumped version number to 0.3.0. |
22 |
!define PYEXIV2_VERSION "0.3.0" |
286.1.15
by Olivier Tilloy
pyexiv2 version as a define. |
23 |
|
24 |
Name "pyexiv2 ${PYEXIV2_VERSION}" |
|
25 |
OutFile "pyexiv2-${PYEXIV2_VERSION}-setup.exe" |
|
286.1.10
by Olivier Tilloy
Better compression. |
26 |
SetCompressor /SOLID lzma |
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
27 |
|
286.1.7
by Olivier Tilloy
Added an icon to the (un)installer |
28 |
!define MUI_ICON "art\pyexiv2.ico" |
29 |
!define MUI_UNICON "art\pyexiv2.ico" |
|
30 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
31 |
; Installer pages
|
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
32 |
!insertmacro MUI_PAGE_LICENSE "COPYING" |
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
33 |
Page custom InstallationOptions InstallationOptionsLeave
|
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
34 |
!insertmacro MUI_PAGE_INSTFILES
|
286.1.5
by Olivier Tilloy
Write an uninstaller. |
35 |
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
36 |
; Uninstaller pages
|
286.1.5
by Olivier Tilloy
Write an uninstaller. |
37 |
!insertmacro MUI_UNPAGE_CONFIRM
|
38 |
!insertmacro MUI_UNPAGE_INSTFILES
|
|
39 |
||
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
40 |
!insertmacro MUI_LANGUAGE "English" |
41 |
||
286.1.14
by Olivier Tilloy
Python version as a define. |
42 |
!define PYTHON_MAJOR "2" |
321.1.1
by Olivier Tilloy
Updated windows build dependencies: |
43 |
!define PYTHON_MINOR "7" |
286.1.14
by Olivier Tilloy
Python version as a define. |
44 |
!define PYTHON_KEY "Software\Python\PythonCore\${PYTHON_MAJOR}.${PYTHON_MINOR}\InstallPath" |
286.1.15
by Olivier Tilloy
pyexiv2 version as a define. |
45 |
!define PYEXIV2_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\pyexiv2-${PYEXIV2_VERSION}" |
286.1.8
by Olivier Tilloy
Use a define instead of a variable to store the registry key. |
46 |
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
47 |
Var python_install_path
|
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
48 |
Var python_installed_for_all
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
49 |
Var system_wide
|
50 |
Var user_site
|
|
51 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
52 |
; Function called when finishing initialization of the installer
|
286.1.4
by Olivier Tilloy
Detect python installation at init. |
53 |
Function .onInit
|
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
54 |
; The user site directory is always for the current user only, not for all users
|
55 |
SetShellVarContext current |
|
56 |
StrCpy $user_site "$APPDATA\Python\Python${PYTHON_MAJOR}${PYTHON_MINOR}\site-packages" |
|
57 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
58 |
; Look for Python system-wide (HKLM)
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
59 |
SetShellVarContext all |
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
60 |
StrCpy $python_installed_for_all "true" |
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
61 |
ReadRegStr $python_install_path SHCTX ${PYTHON_KEY} "" |
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
62 |
StrCmp $python_install_path "" 0 Continue |
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
63 |
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
64 |
; Look for Python for the current user (HKCU)
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
65 |
SetShellVarContext current |
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
66 |
StrCpy $python_installed_for_all "false" |
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
67 |
ReadRegStr $python_install_path SHCTX ${PYTHON_KEY} "" |
68 |
StrCmp $python_install_path "" 0 Continue |
|
69 |
||
286.1.14
by Olivier Tilloy
Python version as a define. |
70 |
MessageBox MB_OK|MB_ICONSTOP "Unable to locate Python ${PYTHON_MAJOR}.${PYTHON_MINOR}." |
286.1.3
by Olivier Tilloy
Search python installed for the current user only. |
71 |
Quit
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
72 |
|
286.1.4
by Olivier Tilloy
Detect python installation at init. |
73 |
Continue: |
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
74 |
StrCpy $system_wide "$python_install_pathLib\site-packages" |
75 |
FunctionEnd
|
|
76 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
77 |
; Function called when finishing initialization of the uninstaller
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
78 |
Function un.onInit
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
79 |
; Look for pyexiv2 installed system-wide (HKLM)
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
80 |
SetShellVarContext all |
81 |
ReadRegStr $INSTDIR SHCTX ${PYEXIV2_KEY} "InstallLocation" |
|
82 |
StrCmp $INSTDIR "" 0 Continue |
|
83 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
84 |
; Look for pyexiv2 installed for the current user (HKCU)
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
85 |
SetShellVarContext current |
86 |
ReadRegStr $INSTDIR SHCTX ${PYEXIV2_KEY} "InstallLocation" |
|
87 |
StrCmp $INSTDIR "" 0 Continue |
|
88 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
89 |
; Cannot find pyexiv2 in the registry, aborting the uninstallation
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
90 |
MessageBox MB_OK|MB_ICONSTOP "Unable to locate $(^Name)." |
91 |
Quit
|
|
92 |
||
93 |
Continue: |
|
94 |
FunctionEnd
|
|
95 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
96 |
; Custom page initialization for installation options
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
97 |
Function InstallationOptions
|
98 |
!insertmacro MUI_HEADER_TEXT "Installation options" "Choose where to install pyexiv2." |
|
99 |
||
100 |
nsDialogs::Create 1018 |
|
101 |
Var /GLOBAL dialog |
|
102 |
Pop $dialog |
|
103 |
${If} $dialog == error |
|
104 |
Abort
|
|
105 |
${EndIf}
|
|
106 |
||
107 |
${NSD_CreateRadioButton} 0 0 100% 24u "System wide ($system_wide)" |
|
108 |
Var /GLOBAL rb1 |
|
109 |
Pop $rb1 |
|
110 |
${NSD_SetState} $rb1 ${BST_CHECKED} |
|
111 |
||
112 |
${NSD_CreateRadioButton} 0 34 100% 24u "User site ($user_site)" |
|
113 |
Var /GLOBAL rb2 |
|
114 |
Pop $rb2 |
|
115 |
||
116 |
nsDialogs::Show |
|
117 |
FunctionEnd
|
|
118 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
119 |
; Custom page on-leave callback
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
120 |
Function InstallationOptionsLeave
|
121 |
${NSD_GetState} $rb1 $0 |
|
122 |
${If} $0 == ${BST_CHECKED} |
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
123 |
; Install pyexiv2 system wide
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
124 |
StrCpy $INSTDIR $system_wide |
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
125 |
|
126 |
; If Python was installed for all users, the user needs to be an
|
|
127 |
; administrator to install pyexiv2
|
|
128 |
StrCmp $python_installed_for_all "true" 0 Continue |
|
129 |
userInfo::getAccountType |
|
130 |
pop $0 |
|
131 |
StrCmp $0 "Admin" Continue 0 |
|
132 |
||
133 |
MessageBox MB_OK|MB_ICONSTOP "You need to be an administrator to install $(^Name)." |
|
134 |
Quit
|
|
135 |
||
136 |
Continue: |
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
137 |
${Else}
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
138 |
; Install pyexiv2 in the user site directory
|
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
139 |
StrCpy $INSTDIR $user_site |
286.1.20
by Olivier Tilloy
The user site directory is always for the current user only. |
140 |
SetShellVarContext current |
286.1.12
by Olivier Tilloy
Custom page to select where to install pyexiv2. |
141 |
${EndIf}
|
286.1.4
by Olivier Tilloy
Detect python installation at init. |
142 |
FunctionEnd
|
143 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
144 |
; Installation section
|
286.1.4
by Olivier Tilloy
Detect python installation at init. |
145 |
Section "pyexiv2" |
286.1.5
by Olivier Tilloy
Write an uninstaller. |
146 |
SetOutPath $INSTDIR |
286.1.4
by Olivier Tilloy
Detect python installation at init. |
147 |
File build\libexiv2python.pyd |
286.1.6
by Olivier Tilloy
Add an entry to uninstall pyexiv2 in "Add/Remove Programs". |
148 |
|
286.1.5
by Olivier Tilloy
Write an uninstaller. |
149 |
SetOutPath $INSTDIR\pyexiv2 |
286.1.4
by Olivier Tilloy
Detect python installation at init. |
150 |
File src\pyexiv2\__init__.py |
151 |
File src\pyexiv2\metadata.py |
|
152 |
File src\pyexiv2\exif.py |
|
153 |
File src\pyexiv2\iptc.py |
|
154 |
File src\pyexiv2\xmp.py |
|
315.1.3
by Olivier Tilloy
Add the new preview module to the build rules. |
155 |
File src\pyexiv2\preview.py |
286.1.4
by Olivier Tilloy
Detect python installation at init. |
156 |
File src\pyexiv2\utils.py |
286.1.6
by Olivier Tilloy
Add an entry to uninstall pyexiv2 in "Add/Remove Programs". |
157 |
|
286.1.17
by Olivier Tilloy
Comments in the installer script. |
158 |
; Create the uninstaller and publish it in the registry
|
286.1.16
by Olivier Tilloy
Add a silent uninstaller. |
159 |
!define UNINSTALLER "$INSTDIR\pyexiv2-${PYEXIV2_VERSION}-uninstaller.exe" |
160 |
WriteUninstaller ${UNINSTALLER} |
|
286.1.15
by Olivier Tilloy
pyexiv2 version as a define. |
161 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayName" "pyexiv2 ${PYEXIV2_VERSION}" |
162 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayVersion" ${PYEXIV2_VERSION} |
|
286.1.16
by Olivier Tilloy
Add a silent uninstaller. |
163 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "DisplayIcon" "$\"${UNINSTALLER}$\"" |
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
164 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "InstallLocation" $INSTDIR |
286.1.16
by Olivier Tilloy
Add a silent uninstaller. |
165 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "UninstallString" "$\"${UNINSTALLER}$\"" |
166 |
WriteRegStr SHCTX ${PYEXIV2_KEY} "QuietUninstallString" "$\"${UNINSTALLER}$\" /S" |
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
167 |
WriteRegDWORD SHCTX ${PYEXIV2_KEY} "NoModify" 1 |
168 |
WriteRegDWORD SHCTX ${PYEXIV2_KEY} "NoRepair" 1 |
|
286.1.5
by Olivier Tilloy
Write an uninstaller. |
169 |
SectionEnd
|
170 |
||
286.1.17
by Olivier Tilloy
Comments in the installer script. |
171 |
; Uninstallation section
|
286.1.5
by Olivier Tilloy
Write an uninstaller. |
172 |
Section "Uninstall" |
173 |
Delete $INSTDIR\libexiv2python.py* |
|
174 |
RMDir /r $INSTDIR\pyexiv2 |
|
286.1.6
by Olivier Tilloy
Add an entry to uninstall pyexiv2 in "Add/Remove Programs". |
175 |
|
286.1.13
by Olivier Tilloy
Follow python's installation policy (all users or current user only). |
176 |
DeleteRegKey SHCTX ${PYEXIV2_KEY} |
286.1.6
by Olivier Tilloy
Add an entry to uninstall pyexiv2 in "Add/Remove Programs". |
177 |
|
286.1.15
by Olivier Tilloy
pyexiv2 version as a define. |
178 |
Delete $INSTDIR\pyexiv2-${PYEXIV2_VERSION}-uninstaller.exe |
286.1.1
by Olivier Tilloy
First draft of an NSIS installer script for windows (basic but functional). |
179 |
SectionEnd
|
180 |