/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2005-10-19 10:11:57 UTC
  • mfrom: (1185.16.78)
  • mto: This revision was merged to the branch mainline in revision 1470.
  • Revision ID: robertc@robertcollins.net-20051019101157-17438d311e746b4f
mergeĀ fromĀ upstream

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 brz.iss.cog source') ]]]
3
 
; [[[end]]]
4
 
; Cog is http://www.nedbatchelder.com/code/cog/
5
 
 
6
 
[Setup]
7
 
AppName=Breezy
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 breezy
19
 
; try:
20
 
;     VERSION = breezy.__version__
21
 
;     AppVerName = 'Breezy %s' % VERSION
22
 
;     OutputBaseFilename = 'brz-%s-setup' % VERSION
23
 
; except:
24
 
;     VERSION = ''
25
 
;     AppVerName = 'Breezy'
26
 
;     OutputBaseFilename = 'brz-setup'
27
 
;
28
 
; cog.outl('AppVerName=%s' % AppVerName)
29
 
; cog.outl('OutputBaseFilename=%s' % OutputBaseFilename)
30
 
; ]]]
31
 
AppVerName=Breezy
32
 
OutputBaseFilename=brz-setup
33
 
; [[[end]]]
34
 
 
35
 
DefaultDirName={pf}\Breezy
36
 
DefaultGroupName=Breezy
37
 
 
38
 
SolidCompression=yes
39
 
 
40
 
OutputDir="..\"
41
 
SourceDir="..\..\win32_brz.exe"
42
 
 
43
 
; TODO(jelmer): Add brz.ico
44
 
; SetupIconFile="..\brz.ico"
45
 
InfoBeforeFile="..\tools\win32\info.txt"
46
 
 
47
 
; VersionInfoCompany="Canonical Ltd."
48
 
VersionInfoCopyright="Canonical Ltd. et al"
49
 
VersionInfoDescription="Windows installer for Breezy"
50
 
; [[[cog
51
 
; import breezy
52
 
; version_number = []
53
 
; for i in breezy.version_info[:3]:
54
 
;     try:
55
 
;         i = int(i)
56
 
;     except ValueError:
57
 
;         i = 0
58
 
;     version_number.append(i)
59
 
; # incremental build number
60
 
; from tools.win32.file_version import *
61
 
; try:
62
 
;     version_prev = get_file_version(OutputBaseFilename + '.exe')
63
 
; except (FileNotFound, VersionNotAvailable):
64
 
;     pass
65
 
; else:
66
 
;     if version_number == list(version_prev[:3]):
67
 
;         version_number.append((version_prev[-1]+1) % 65536)
68
 
; version_str = '.'.join(str(i) for i in version_number)
69
 
; cog.outl('VersionInfoVersion="%s"' % version_str)
70
 
; ]]]
71
 
; [[[end]]]
72
 
 
73
 
AppComments="Breezy: Friendly distributed version control system"
74
 
AppPublisher="Breezy Developers"
75
 
AppPublisherURL="https://www.breezy-vcs.org/"
76
 
AppSupportURL="http://wiki.bazaar.canonical.com/BzrSupport"
77
 
AppUpdatesURL="http://wiki.bazaar.canonical.com/WindowsDownloads"
78
 
; [[[cog cog.outl('AppVersion=%s' % VERSION) ]]]
79
 
; [[[end]]]
80
 
 
81
 
ChangesEnvironment=yes
82
 
; MARKH: PrivilegesRequired=none means it can't be installed by a non-admin
83
 
; user - but sadly we still need admin - eg, tortoise overlays, installing
84
 
; into "\Program Files", installing COM objects etc all must be done by an
85
 
; admin.
86
 
PrivilegesRequired=admin
87
 
 
88
 
[Files]
89
 
; Tortoise files - these are at the top as we use 'ExtractTemporaryFile' on
90
 
; the TortoiseOverlays MSI, and inno documents such files should be at the
91
 
; start for best performance.
92
 
; [[[cog
93
 
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
94
 
;     tovmsi32 = os.environ["TORTOISE_OVERLAYS_MSI_WIN32"] # point at the 32bit TortoiseOverlays .msi
95
 
;     tovmsi64 = os.environ["TORTOISE_OVERLAYS_MSI_X64"] # point at the 64bit TortoiseOverlays .msi
96
 
;     cog.outl('Source: "%s"; Flags: dontcopy ignoreversion ; Components: tortoise' % tovmsi32)
97
 
;     cog.outl('Source: "%s"; Flags: dontcopy ignoreversion ; Components: tortoise' % tovmsi64)
98
 
;     cog.outl('Source: "tbzrcache.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
99
 
;     cog.outl('Source: "tbzrcachew.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
100
 
;     cog.outl('Source: "tbzrcommand.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
101
 
;     cog.outl('Source: "tbzrcommandw.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
102
 
;     cog.outl('Source: "tbzrtrace.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: debug')
103
 
;     # Note 'regserver' here appears to run regsvr32 without elevation, which
104
 
;     # is no good for us - so we have a [run] entry below.
105
 
;     cog.outl('Source: "tbzr_old.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
106
 
;     cog.outl('Source: "tbzrshellext_x86.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise')
107
 
;     cog.outl('Source: "tbzrshellext_x64.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete; Components: tortoise; Check: IsWin64;')
108
 
;     cog.outl(r'Source: "plugins\qbzr\*"; DestDir: "{app}\plugins\qbzr"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: tortoise')
109
 
;
110
 
;     cog.outl('Source: "%s\\doc\\*.html"; DestDir: "{app}\\doc\\tbzr"; Flags: ignoreversion; Components: tortoise' % os.environ['TBZR'])
111
 
; ]]]
112
 
; [[[end]]]
113
 
 
114
 
; We can't say '*.*' due to optional components.
115
 
Source: "plugins\*.*"; DestDir: "{app}\\plugins"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete; Components: plugins
116
 
Source: "*.bat"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
117
 
Source: "*.url"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
118
 
Source: "msvc*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
119
 
Source: "bz*.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
120
 
Source: "Python*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace uninsrestartdelete;
121
 
Source: "lib\*.*"; DestDir: "{app}\lib"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
122
 
Source: "doc\*.*"; DestDir: "{app}\doc"; Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;
123
 
; [[[cog
124
 
; try:
125
 
;     import pycurl
126
 
; except ImportError:
127
 
;     ca_path = None
128
 
; else:
129
 
;     supported = pycurl.version_info()[8]
130
 
;     if 'https' in supported:
131
 
;         from breezy.transport.http.ca_bundle import get_ca_path
132
 
;         ca_path = get_ca_path()
133
 
;         if ca_path:
134
 
;             cog.outl('Source: "%s"; DestDir: "{app}"; Components: cabundle' % ca_path)
135
 
;         else:
136
 
;             cog.msg('You have pycurl with SSL support, '
137
 
;                     'but CA Bundle (curl-ca-bundle.crt) not found!')
138
 
; ]]]
139
 
; [[[end]]]
140
 
 
141
 
; imageformats plugins for PyQt4
142
 
; [[[cog
143
 
; plug_dir = os.path.join(os.path.dirname(cog.inFile), # $(bzr_src_root)/tools/win32
144
 
;                         '..', '..', 'win32_bzr.exe', 'imageformats')
145
 
; if os.path.isdir(plug_dir):
146
 
;     cog.outl('Source: "imageformats\\*.*"; DestDir: "{app}\\imageformats"; '
147
 
;              'Flags: createallsubdirs ignoreversion recursesubdirs restartreplace uninsrestartdelete;')
148
 
; else:
149
 
;     cog.msg('imageformats plugins for PyQt4 not found')
150
 
; ]]]
151
 
; [[[end]]]
152
 
 
153
 
[Types]
154
 
Name: "typical"; Description: "A typical installation"
155
 
Name: "full"; Description: "Full Installation (typical installation plus test utilities)"
156
 
Name: "compact"; Description: "Compact installation"
157
 
Name: "custom"; Description: "Custom installation"; Flags: iscustom
158
 
 
159
 
[Components]
160
 
Name: "main"; Description: "Main Files"; Types: full typical compact custom; Flags: fixed
161
 
Name: "plugins"; Description: "Default plugins"; Types: full typical custom;
162
 
; [[[cog
163
 
; if ca_path:
164
 
;     cog.outl('Name: "cabundle"; '
165
 
;              'Description: "CA certificates for SSL support"; '
166
 
;              'Types: full typical custom')
167
 
; if "TBZR" in os.environ: # we need a more formal way of controlling this...
168
 
;     cog.outl('Name: "tortoise"; Description: "Windows Shell Extensions (TortoiseBZR)"; Types: full typical custom;')
169
 
;     cog.outl('Name: "debug"; Description: "Test, diagnostic and debugging utilities"; Types: full custom;')
170
 
;
171
 
; ]]]
172
 
; [[[end]]]
173
 
 
174
 
[Dirs]
175
 
Name: "{userappdata}\bazaar\2.0"
176
 
Name: "{app}\plugins"; Flags: uninsalwaysuninstall
177
 
 
178
 
 
179
 
[Icons]
180
 
Name: "{group}\Documentation index"; Filename: "{app}\doc\index.html"; WorkingDir: "{app}\doc";
181
 
Name: "{group}\Breezy Home Page"; Filename: "{app}\breezy.url"; Comment: "https://www.breezy-vcs.org/";
182
 
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";
183
 
; NOTE: Intent is to change the log file location - the line below will need to change to reflect that.
184
 
Name: "{group}\Open Bzr log file"; Filename: "notepad.exe"; Parameters: "{userdocs}\.bzr.log"; Comment: "Launch notepad to view the bzr log file";
185
 
 
186
 
; [[[cog
187
 
; if "TBZR" in os.environ:
188
 
;     cog.outl(r'Name: "{group}\TortoiseBZR documentation"; Filename: "{app}\doc\tbzr\index.html"; Comment: "Launch TortoiseBZR documentation";')
189
 
; ]]]
190
 
; [[[end]]]
191
 
; No Uninstall here - Control Panel will do
192
 
 
193
 
 
194
 
[Tasks]
195
 
Name: Path; Description: "Add {app} directory to PATH environment variable"
196
 
; [[[cog
197
 
; if "TBZR" in os.environ:
198
 
;     cog.outl('Name: TBZRReadme; Description: "View the TortoiseBZR Readme"; Components: tortoise')
199
 
; ]]]
200
 
; [[[end]]]
201
 
 
202
 
 
203
 
[Registry]
204
 
Root: HKLM; Subkey: "SOFTWARE\Breezy"; Flags: noerror uninsdeletekey
205
 
Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "InstallPath"; ValueType: string; ValueData: "{app}"; Flags: noerror
206
 
; Don't write stuff that can be implied
207
 
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "breezyPath"; ValueType: string; ValueData: "{app}\lib\library.zip\breezy"; Flags: noerror
208
 
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "PluginsPath"; ValueType: string; ValueData: "{app}\plugins"; Flags: noerror
209
 
;Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "PythonPath"; ValueType: string; ValueData: "{app}\lib\library.zip"; Flags: noerror
210
 
; [[[cog cog.outl('Root: HKLM; Subkey: "SOFTWARE\Breezy"; ValueName: "Version"; ValueType: string; ValueData: "%s"; Flags: noerror' % VERSION) ]]]
211
 
; [[[end]]]
212
 
 
213
 
 
214
 
[Run]
215
 
Filename: "{app}\brz_postinstall.exe"; Parameters: "--start-brz"; Flags: skipifdoesntexist runhidden;
216
 
Filename: "{app}\brz_postinstall.exe"; Parameters: "--add-path"; Tasks: Path; Flags: skipifdoesntexist skipifsilent runhidden;
217
 
; [[[cog
218
 
; if "TBZR" in os.environ:
219
 
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/s /i: /n tbzrshellext_x86.dll"; WorkingDir: "{app}"; Components: tortoise; Description: "Registering Tortoise"; StatusMsg: "Registering Tortoise"')
220
 
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/s /i: /n tbzrshellext_x64.dll"; WorkingDir: "{app}"; Components: tortoise; Description: "Registering Tortoise"; StatusMsg: "Registering Tortoise"; Check: IsWin64')
221
 
;     cog.outl(r'Filename: "{app}\doc\tbzr\index.html"; Tasks: TBZRReadme; Flags: shellexec')
222
 
; ]]]
223
 
; [[[end]]]
224
 
 
225
 
 
226
 
[UninstallRun]
227
 
Filename: "{app}\bzr_postinstall.exe"; Parameters: "--delete-path --delete-shell-menu --silent"; Flags: skipifdoesntexist runhidden;
228
 
; [[[cog
229
 
; if "TBZR" in os.environ:
230
 
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/u /s /i: tbzrshellext_x86.dll"; WorkingDir: "{app}"; Components: tortoise; StatusMsg: "Unregistering Tortoise"; Flags: skipifdoesntexist')
231
 
;     cog.outl('Filename: "regsvr32.exe"; Parameters: "/u /s /i: tbzrshellext_x64.dll"; WorkingDir: "{app}"; Components: tortoise; StatusMsg: "Unregistering Tortoise"; Flags: skipifdoesntexist; Check: IsWin64')
232
 
; ]]]
233
 
; [[[end]]]
234
 
 
235
 
 
236
 
[Code]
237
 
const
238
 
  SHCNF_IDLIST = $0000;
239
 
  SHCNE_ASSOCCHANGED = $08000000;
240
 
  WM_QUIT = 18;
241
 
  MOVEFILE_DELAY_UNTIL_REBOOT    = 4;
242
 
 
243
 
procedure SHChangeNotify(wEventId, uFlags, dwItem1, dwItem2: Integer);
244
 
 external 'SHChangeNotify@shell32.dll stdcall';
245
 
 
246
 
function MoveFileEx(lpExistingFileName, lpNewFileName: String; dwFlags: Cardinal): Integer;
247
 
 external 'MoveFileExA@kernel32.dll stdcall';
248
 
 
249
 
procedure DeleteFileNowOrLater(filename: string);
250
 
var
251
 
  rc : Integer;
252
 
begin
253
 
    if FileExists(filename) and not DeleteFile(filename) then
254
 
        // can't work out to pass NULL to the API, but an empty string
255
 
        // seems to work OK.
256
 
        MoveFileEx(filename, '', MOVEFILE_DELAY_UNTIL_REBOOT);
257
 
end;
258
 
 
259
 
procedure ShutdownTBZR;
260
 
var
261
 
    hwnd: HWND;
262
 
begin
263
 
// [[[cog
264
 
// if "TBZR" not in os.environ:
265
 
//     cog.outl('        Exit;  // No TSVN set - exit this procedure.')
266
 
// ]]]
267
 
// [[[end]]]
268
 
    // ask the cache process to shut-down.
269
 
    hwnd := FindWindowByClassName('TBZRCache_Taskbar');
270
 
    if hwnd <> 0 then
271
 
        PostMessage(hwnd, WM_QUIT, 1, 0);
272
 
end;
273
 
 
274
 
procedure CurStepChanged(CurStep: TSetupStep);
275
 
var
276
 
    S, tovmsi, fqtovmsi, params: String;
277
 
    ErrorCode: Integer;
278
 
begin
279
 
    if CurStep=ssInstall then begin
280
 
        ShutdownTBZR;
281
 
        // In case the user hasn't uninstalled the old version before
282
 
        // upgrading, we unregister and delete some obsolete files
283
 
        // (regsvr32 remains silent even if the file doesn't exist)
284
 
        Exec('regsvr32.exe', '/s /u "' + ExpandConstant('{app}\tbzr.dll') + '"',
285
 
             '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
286
 
        DeleteFileNowOrLater(ExpandConstant('{app}\tbzr.dll'));
287
 
        DeleteFileNowOrLater(ExpandConstant('{app}\tbzrtest.exe'));
288
 
        DeleteFileNowOrLater(ExpandConstant('{app}\tbzr_tracer.exe'));
289
 
    end;
290
 
 
291
 
    if CurStep=ssPostInstall then begin
292
 
        // a couple of post-install tasks
293
 
        if IsComponentSelected('tortoise') then begin
294
 
            // Need to execute:
295
 
            // msiexec /i TortoiseOverlays-1.X.X.XXXX-win32.msi /qn /norestart
296
 
// 64bit notes:
297
 
// We are still primarily a 32bit application - the only 64bit binary is the
298
 
// shell extension, but even then, we need to install the 32bit version too.
299
 
// Thus, we keep tortoise in 32bit "install mode" - meaning we are installed
300
 
// to "\Program Files (x86)".  We don't bother trying to install our single
301
 
// 64bit DLL into "\Program Files" - we use a different DLL name for 32 and
302
 
// 64 bit versions, so nothing will conflict.
303
 
// Note however that on a 64bit OS, we only need the 64bit TortoiseOverlays -
304
 
// the 32bit apps using shell extensions still work fine with that.
305
 
// [[[cog
306
 
// if "TBZR" in os.environ:
307
 
//     import os
308
 
//     cog.outl("if IsWin64 then")
309
 
//     cog.outl("  tovmsi := '%s'" % os.path.basename(os.environ["TORTOISE_OVERLAYS_MSI_X64"]))
310
 
//     cog.outl("else")
311
 
//     cog.outl("  tovmsi := '%s'" % os.path.basename(os.environ["TORTOISE_OVERLAYS_MSI_WIN32"]))
312
 
// else:
313
 
//     cog.outl("tovmsi := '';")
314
 
// ]]]
315
 
// [[[end]]]
316
 
            ExtractTemporaryFile(tovmsi);
317
 
            fqtovmsi := AddBackslash(ExpandConstant('{tmp}')) + tovmsi;
318
 
            params := '/i "' + fqtovmsi + '" /qn /norestart';
319
 
            if not ShellExec('', 'msiexec.exe', params, '', SW_HIDE,
320
 
                             ewWaitUntilTerminated, ErrorCode) then
321
 
                MsgBox('Failed to install TortoiseOverlays: ' + SysErrorMessage(ErrorCode),
322
 
                        mbInformation, MB_OK);
323
 
            // Ideally we could be bzr_postinstall.exe this way too, but
324
 
            // its needed at uninstall time.
325
 
        end;
326
 
        // cause explorer to re-fetch handlers.
327
 
        SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, 0, 0);
328
 
    end;
329
 
end;
330
 
 
331
 
 
332
 
function InitializeUninstall(): Boolean;
333
 
begin
334
 
    ShutdownTBZR;
335
 
    result := True;
336
 
end;