~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/win32/bzr.iss.cog

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
; Script for Inno Setup installer
 
2
; [[[cog cog.outl('; This script created by Cog from bzr.iss.cog source') ]]]
 
3
; [[[end]]]
 
4
; Cog is http://www.nedbatchelder.com/code/cog/
 
5
 
 
6
[Setup]
 
7
AppName=Bazaar
 
8
 
 
9
; [[[cog
 
10
; # Python 2.5 compatibility code
 
11
; import os
 
12
; import sys
 
13
; cwd = os.getcwd()
 
14
; if cwd not in sys.path:
 
15
;     sys.path.insert(0, cwd)
 
16
; #/Python 2.5 compatibility code
 
17
;
 
18
; import bzrlib
 
19
; try: 
 
20
;     VERSION = bzrlib.__version__
 
21
;     AppVerName = 'Bazaar %s' % VERSION
 
22
;     OutputBaseFilename = 'bzr-setup-%s' % VERSION
 
23
; except:
 
24
;     VERSION = ''
 
25
;     AppVerName = 'Bazaar'
 
26
;     OutputBaseFilename = 'bzr-setup'
 
27
;
 
28
; cog.outl('AppVerName=%s' % AppVerName)
 
29
; cog.outl('OutputBaseFilename=%s' % OutputBaseFilename)
 
30
; ]]]
 
31
AppVerName=Bazaar
 
32
OutputBaseFilename=bzr-setup
 
33
; [[[end]]]
 
34
 
 
35
DefaultDirName={pf}\Bazaar
 
36
DefaultGroupName=Bazaar
 
37
 
 
38
SolidCompression=yes
 
39
 
 
40
OutputDir="..\"
 
41
SourceDir="..\..\win32_bzr.exe"
 
42
 
 
43
SetupIconFile="..\bzr.ico"
 
44
InfoBeforeFile="..\tools\win32\info.txt"
 
45
 
 
46
VersionInfoCompany="Canonical Ltd."
 
47
VersionInfoCopyright="Canonical Ltd., 2005-2008"
 
48
VersionInfoDescription="Windows installer for Bazaar"
 
49
; [[[cog
 
50
; import bzrlib
 
51
; version_number = []
 
52
; for i in bzrlib.version_info[:3]:
 
53
;     try:
 
54
;         i = int(i)
 
55
;     except ValueError:
 
56
;         i = 0
 
57
;     version_number.append(i)
 
58
; # incremental build number
 
59
; from tools.win32.file_version import *
 
60
; try:
 
61
;     version_prev = get_file_version(OutputBaseFilename + '.exe')
 
62
; except (FileNotFound, VersionNotAvailable):
 
63
;     pass
 
64
; else:
 
65
;     if version_number == list(version_prev[:3]):
 
66
;         version_number.append((version_prev[-1]+1) % 65536)
 
67
; version_str = '.'.join(str(i) for i in version_number)
 
68
; cog.outl('VersionInfoVersion="%s"' % version_str)
 
69
; ]]]
 
70
; [[[end]]]
 
71
 
 
72
AppComments="Bazaar: Friendly distributed version control system"
 
73
AppPublisher="Canonical Ltd."
 
74
AppPublisherURL="http://www.bazaar-vcs.org"
 
75
AppSupportURL="http://www.bazaar-vcs.org/BzrSupport"
 
76
AppUpdatesURL="http://www.bazaar-vcs.org/WindowsDownloads"
 
77
; [[[cog cog.outl('AppVersion=%s' % VERSION) ]]]
 
78
; [[[end]]]
 
79
 
 
80
ChangesEnvironment=yes
 
81
; MARKH: PrivilegesRequired=none means it can't be installed by a non-admin
 
82
; user - but sadly we still need admin - eg, tortoise overlays, installing
 
83
; into "\Program Files", installing COM objects etc all must be done by an
 
84
; admin.
 
85
PrivilegesRequired=admin
 
86
 
 
87
[Files]
 
88
; Tortoise files - these are at the top as we use 'ExtractTemporaryFile' on
 
89
; the TortoiseOverlays MSI, and inno documents such files should be at the
 
90
; start for best performance.
 
91
; [[[cog
 
92
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
 
93
;     tovmsi = os.environ["TORTOISE_OVERLAYS_MSI_WIN32"] # point at TortoiseOverlays .msi
 
94
;     cog.outl('Source: "%s"; Flags: dontcopy ignoreversion ; Components: tortoise' % tovmsi)
 
95
;     cog.outl('Source: "tbzrcache.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
 
96
;     cog.outl('Source: "tbzrcachew.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
 
97
;     cog.outl('Source: "tbzrcommand.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
 
98
;     cog.outl('Source: "tbzrcommandw.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
 
99
;     cog.outl('Source: "tbzr_tracer.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: debug')
 
100
;     # Note 'regserver' here appears to run regsvr32 without elevation, which
 
101
;     # is no good for us - so we have a [run] entry below.
 
102
;     cog.outl('Source: "tbzr.dll"; DestDir: "{app}"; Flags: ignoreversion regserver restartreplace uninsrestartdelete; Components: tortoise')
 
103
;     cog.outl(r'Source: "plugins\qbzr\*"; DestDir: "{app}\plugins\qbzr"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: tortoise')
 
104
;
 
105
;     cog.outl('Source: "%s\\doc\\index.html"; DestDir: "{app}\\doc\\tbzr"; Flags: ignoreversion; Components: tortoise' % os.environ['TBZR'])
 
106
; ]]]
 
107
; [[[end]]]
 
108
 
 
109
; We can't say '*.*' due to optional components.
 
110
Source: "plugins\*.*"; DestDir: "{app}\\plugins"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: plugins
 
111
Source: "*.bat"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
 
112
Source: "*.url"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
 
113
Source: "msvc*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
 
114
Source: "bz*.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
 
115
Source: "Python*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
 
116
Source: "lib\*.*"; DestDir: "{app}\lib"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
 
117
Source: "doc\*.*"; DestDir: "{app}\doc"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
 
118
; [[[cog
 
119
; try:
 
120
;     import pycurl
 
121
; except ImportError:
 
122
;     ca_path = None
 
123
; else:
 
124
;     supported = pycurl.version_info()[8]
 
125
;     if 'https' in supported:
 
126
;         from bzrlib.transport.http.ca_bundle import get_ca_path
 
127
;         ca_path = get_ca_path()
 
128
;         if ca_path:
 
129
;             cog.outl('Source: "%s"; DestDir: "{app}"; Components: cabundle' % ca_path)
 
130
;         else:
 
131
;             cog.msg('You have pycurl with SSL support, '
 
132
;                     'but CA Bundle (curl-ca-bundle.crt) not found!')
 
133
; ]]]
 
134
; [[[end]]]
 
135
 
 
136
[Types]
 
137
Name: "typical"; Description: "A typical installation"
 
138
Name: "full"; Description: "Full Installation (typical installation plus test utilities)"
 
139
Name: "compact"; Description: "Compact installation"
 
140
Name: "custom"; Description: "Custom installation"; Flags: iscustom
 
141
 
 
142
[Components]
 
143
Name: "main"; Description: "Main Files"; Types: full typical compact custom; Flags: fixed
 
144
Name: "plugins"; Description: "Default plugins"; Types: full typical custom;
 
145
; [[[cog
 
146
; if ca_path:
 
147
;     cog.outl('Name: "cabundle"; '
 
148
;              'Description: "CA certificates for SSL support"; '
 
149
;              'Types: full typical custom')
 
150
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
 
151
;     cog.outl('Name: "tortoise"; Description: "Windows Shell Extensions (TortoiseBZR) - EXPERIMENTAL"; Types: full typical custom;')
 
152
;     cog.outl('Name: "debug"; Description: "Test, diagnostic and debugging utilities"; Types: full custom;')
 
153
;
 
154
; ]]]
 
155
; [[[end]]]
 
156
 
 
157
[Dirs]
 
158
Name: "{userappdata}\bazaar\2.0"
 
159
Name: "{app}\plugins"; Flags: uninsalwaysuninstall
 
160
 
 
161
 
 
162
[Icons]
 
163
Name: "{group}\Documentation index"; Filename: "{app}\doc\index.html"; WorkingDir: "{app}\doc";
 
164
Name: "{group}\Bazaar Home Page"; Filename: "{app}\bazaar.url"; Comment: "http://www.bazaar-vcs.org";
 
165
Name: "{group}\Start Bzr in cmd shell"; Filename: "{cmd}"; Parameters: "/K start_bzr.bat"; WorkingDir: "{app}"; IconFilename: "{app}\bzr.exe"; Comment: "Open new Bzr session";
 
166
; NOTE: Intent is to change the log file location - the line below will need to change to reflect that.
 
167
Name: "{group}\Open Bzr log file"; Filename: "notepad.exe"; Parameters: "{userdocs}\.bzr.log"; Comment: "Launch notepad to view the bzr log file";
 
168
 
 
169
; [[[cog
 
170
; if "TBZR" in os.environ:
 
171
;     cog.outl(r'Name: "{group}\TortoiseBZR documentation"; Filename: "{app}\doc\tbzr\index.html"; Comment: "Launch TortoiseBZR documentation";')
 
172
; ]]]
 
173
; [[[end]]]
 
174
; No Uninstall here - Control Panel will do
 
175
 
 
176
 
 
177
[Tasks]
 
178
Name: Path; Description: "Add {app} directory to PATH environment variable"
 
179
; [[[cog
 
180
; if "TBZR" in os.environ:
 
181
;     cog.outl('Name: TBZRReadme; Description: "View the TortoiseBZR Readme"; Components: tortoise')
 
182
; ]]]
 
183
; [[[end]]]
 
184
 
 
185
 
 
186
[Registry]
 
187
Root: HKLM; Subkey: "SOFTWARE\Bazaar"; Flags: noerror uninsdeletekey
 
188
Root: HKLM; Subkey: "SOFTWARE\Bazaar"; ValueName: "InstallPath"; ValueType: string; ValueData: "{app}"; Flags: noerror
 
189
; Don't write stuff that can be implied
 
190
;Root: HKLM; Subkey: "SOFTWARE\Bazaar"; ValueName: "BzrlibPath"; ValueType: string; ValueData: "{app}\lib\library.zip\bzrlib"; Flags: noerror
 
191
;Root: HKLM; Subkey: "SOFTWARE\Bazaar"; ValueName: "PluginsPath"; ValueType: string; ValueData: "{app}\plugins"; Flags: noerror
 
192
;Root: HKLM; Subkey: "SOFTWARE\Bazaar"; ValueName: "PythonPath"; ValueType: string; ValueData: "{app}\lib\library.zip"; Flags: noerror
 
193
; [[[cog cog.outl('Root: HKLM; Subkey: "SOFTWARE\Bazaar"; ValueName: "Version"; ValueType: string; ValueData: "%s"; Flags: noerror' % VERSION) ]]]
 
194
; [[[end]]]
 
195
 
 
196
 
 
197
[Run]
 
198
Filename: "{app}\bzr_postinstall.exe"; Parameters: "--start-bzr"; Flags: skipifdoesntexist runhidden;
 
199
Filename: "{app}\bzr_postinstall.exe"; Parameters: "--add-path"; Tasks: Path; Flags: skipifdoesntexist skipifsilent runhidden;
 
200
; [[[cog
 
201
; if "TBZR" in os.environ:
 
202
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/s tbzr.dll"; WorkingDir: "{app}"; Components: tortoise; Description: "Registering Tortoise"; StatusMsg: "Registering Tortoise"')
 
203
;     cog.outl(r'Filename: "{app}\doc\tbzr\index.html"; Tasks: TBZRReadme; Flags: shellexec')
 
204
; ]]]
 
205
; [[[end]]]
 
206
 
 
207
 
 
208
[UninstallRun]
 
209
Filename: "{app}\bzr_postinstall.exe"; Parameters: "--delete-path --delete-shell-menu --silent"; Flags: skipifdoesntexist runhidden; 
 
210
; [[[cog
 
211
; if "TBZR" in os.environ:
 
212
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/u /s tbzr.dll"; WorkingDir: "{app}"; Components: tortoise; StatusMsg: "Unregistering Tortoise"; Flags: skipifdoesntexist')
 
213
; ]]]
 
214
; [[[end]]]
 
215
 
 
216
 
 
217
[Code]
 
218
const
 
219
  SHCNF_IDLIST = $0000;
 
220
  SHCNE_ASSOCCHANGED = $08000000;
 
221
  WM_QUIT = 18;
 
222
 
 
223
procedure SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2: Integer);
 
224
 external 'SHChangeNotify@shell32.dll stdcall';
 
225
 
 
226
procedure ShutdownTBZR;
 
227
var
 
228
    hwnd: HWND;
 
229
begin
 
230
// [[[cog
 
231
// if "TBZR" not in os.environ:
 
232
//     cog.outl('        Exit;  // No TSVN set - exit this procedure.')
 
233
// ]]]
 
234
// [[[end]]]
 
235
    // ask the cache process to shut-down.
 
236
    hwnd := FindWindowByClassName('TBZRCache_Taskbar');
 
237
    if hwnd <> 0 then
 
238
        PostMessage(hwnd, WM_QUIT, 1, 0);
 
239
end;
 
240
 
 
241
procedure CurStepChanged(CurStep: TSetupStep);
 
242
var
 
243
    S, tovmsi, fqtovmsi, params: String;
 
244
    ErrorCode: Integer;
 
245
begin
 
246
    if CurStep=ssInstall then begin
 
247
        ShutdownTBZR;
 
248
    end;
 
249
 
 
250
    if CurStep=ssPostInstall then begin
 
251
        // a couple of post-install tasks
 
252
        if IsComponentSelected('tortoise') then begin
 
253
            // Need to execute:
 
254
            // msiexec /i TortoiseOverlays-1.X.X.XXXX-win32.msi /qn /norestart
 
255
// [[[cog
 
256
// if "TBZR" in os.environ:
 
257
//     import os
 
258
//     cog.outl("tovmsi := '%s';" % os.path.basename(os.environ["TORTOISE_OVERLAYS_MSI_WIN32"]))
 
259
// else:
 
260
//     cog.outl("tovmsi := '';")
 
261
// ]]]
 
262
// [[[end]]]
 
263
            ExtractTemporaryFile(tovmsi);
 
264
            fqtovmsi := AddBackslash(ExpandConstant('{tmp}')) + tovmsi;
 
265
            params := '/i "' + fqtovmsi + '" /qn /norestart';
 
266
            if not ShellExec('', 'msiexec.exe', params, '', SW_HIDE,
 
267
                             ewWaitUntilTerminated, ErrorCode) then
 
268
                MsgBox('Failed to install TortoiseOverlays: ' + SysErrorMessage(ErrorCode),
 
269
                        mbInformation, MB_OK);
 
270
            // Ideally we could be bzr_postinstall.exe this way too, but
 
271
            // its needed at uninstall time.
 
272
        end;
 
273
        // cause explorer to re-fetch handlers.
 
274
        SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
 
275
    end;
 
276
end;
 
277
 
 
278
 
 
279
function InitializeUninstall(): Boolean; 
 
280
begin
 
281
    ShutdownTBZR;
 
282
    result := True;
 
283
end;