/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/bzr.iss.cog

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

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