Debian Codegraph @

installer/qbrz-setup.iss

raw
1 ; Script initially generated by the Inno Setup Script Wizard
2 ; and then modified by Alexander Belchenko.
3
4 [Setup]
5 ; NOTE: The value of AppId uniquely identifies this application.
6 ; Do not use the same AppId value in installers for other applications.
7 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
8
9 AppId=QBrz
10
11 AppName= QBrz
12 AppVerName= QBrz {#Version}
13 OutputBaseFilename=qbrz-setup-{#Version}
14 ; AppVerName= QBrz 0.3.1
15 ; OutputBaseFilename=qbrz-setup-0.3.1
16
17 SourceDir="..\"
18 OutputDir="."
19 OutputManifestFile=qbrz-setup-iss.log
20
21 AppPublisher=QBrz Developers
22 AppPublisherURL=http://launchpad.net/qbzr
23 AppSupportURL=http://groups.google.com/group/qbzr
24 AppUpdatesURL=http://launchpad.net/qbzr/+download
25
26 DefaultDirName={code:GetDirName}
27
28 DisableProgramGroupPage=yes
29 Compression=lzma
30 SolidCompression=yes
31
32 [Languages]
33 Name: "english"; MessagesFile: "compiler:Default.isl"
34 Name: "basque"; MessagesFile: "compiler:Languages\Basque.isl"
35 Name: "brazilianportuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
36 Name: "catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
37 Name: "czech"; MessagesFile: "compiler:Languages\Czech.isl"
38 Name: "danish"; MessagesFile: "compiler:Languages\Danish.isl"
39 Name: "dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
40 Name: "finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
41 Name: "french"; MessagesFile: "compiler:Languages\French.isl"
42 Name: "german"; MessagesFile: "compiler:Languages\German.isl"
43 Name: "hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
44 Name: "hungarian"; MessagesFile: "compiler:Languages\Hungarian.isl"
45 Name: "italian"; MessagesFile: "compiler:Languages\Italian.isl"
46 Name: "norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
47 Name: "polish"; MessagesFile: "compiler:Languages\Polish.isl"
48 Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
49 Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
50 Name: "slovak"; MessagesFile: "compiler:Languages\Slovak.isl"
51 Name: "slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
52 Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
53
54 [Files]
55 Source: "__init__.py"; DestDir: {app};
56 Source: "lib\*.py"; DestDir: {app}\lib; Flags: recursesubdirs;
57 Source: "*.txt"; DestDir: {app};
58 Source: "locale\*.*"; DestDir: {app}\locale; Flags: recursesubdirs;
59
60 [UninstallDelete]
61 ; TODO: create special uninstall function in Code section to recursively delete pyc/pyo files
62 ; using FindFile API
63 Type: files; Name: {app}\*.pyc
64 Type: files; Name: {app}\lib\*.pyc
65 Type: files; Name: {app}\lib\extra\*.pyc
66 Type: files; Name: {app}\lib\tests\*.pyc
67 Type: files; Name: {app}\lib\widgets\*.pyc
68
69 Type: files; Name: {app}\*.pyo
70 Type: files; Name: {app}\lib\*.pyo
71 Type: files; Name: {app}\lib\extra\*.pyo
72 Type: files; Name: {app}\lib\tests\*.pyo
73 Type: files; Name: {app}\lib\widgets\*.pyo
74
75 [Registry]
76 Root: HKLM; Subkey: "Software\QBrz"; Flags: uninsdeletekey
77 Root: HKLM; Subkey: "Software\QBrz"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
78
79 [Code]
80 {Function detects system-wide installation of brz: either brz.exe or python-based}
81 function GetBrzPath(): String;
82 var
83 BrzPath: String;
84 PythonVersions: TArrayOfString;
85 Ix: Integer;
86 PythonKey: String;
87 PythonPath: String;
88 BrzlibPath: String;
89 Path: String;
90 begin
91 {Check brz.exe presence}
92 if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Breezy', 'InstallPath', BrzPath) then begin
93 Result := BrzPath;
94 end else begin
95 BrzlibPath := '';
96 {Get list of all installed python versions}
97 if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'Software\Python\PythonCore', PythonVersions) then begin
98 {Iterate over installed pythons and check if there is installed bzrlib}
99 for Ix := 0 to GetArrayLength(PythonVersions)-1 do begin
100 PythonKey := 'Software\Python\PythonCore\' + PythonVersions[Ix] + '\InstallPath'
101 if RegQueryStringValue(HKEY_LOCAL_MACHINE, PythonKey, '', PythonPath) then begin
102 Path := AddBackslash(PythonPath) + 'Lib\site-packages\bzrlib'
103 if DirExists(Path) then begin
104 BrzlibPath := Path;
105 break;
106 end;
107 end;
108 end;
109 end;
110 Result := BrzlibPath;
111 end;
112 end;
113
114 {Function determines best possible PATH to install QBrz.
115 At first it tries to find system-wide installation (either brz.exe or python-based)
116 then checks BRZ_PLUGIN_PATH,
117 if all above fails then it suggests install to %APPDATA%\Breezy\2.0
118 }
119 function GetDirName(Param: String): String;
120 var
121 Path: String;
122 BrzPath: String;
123 EnvBrzPluginPath: String;
124 Ix: Integer;
125 begin
126 Path := ExpandConstant('{userappdata}\Breezy\2.0\plugins\qbzr');
127 BrzPath := GetBrzPath();
128 if BrzPath <> '' then begin
129 Path := AddBackslash(BrzPath) + 'plugins\qbzr';
130 end else begin
131 EnvBrzPluginPath := GetEnv('BRZ_PLUGIN_PATH')
132 Ix := Pos(';', EnvBrzPluginPath)
133 if Ix > 0 then
134 EnvBrzPluginPath := Copy(EnvBrzPluginPath, 1, Ix-1)
135 if EnvBrzPluginPath <> '' then
136 Path := AddBackslash(EnvBrzPluginPath) + 'qbzr';
137 end;
138 Result := Path;
139 end;