~javierder/qbzr/send

« back to all changes in this revision

Viewing changes to installer/qbzr-setup.iss

  • Committer: Alexander Belchenko
  • Date: 2009-06-15 10:55:06 UTC
  • mfrom: (769.1.4 r769)
  • Revision ID: bialix@ukr.net-20090615105506-a44vstz4lhhruvjo
improvements for windows installer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
; Script initially generated by the Inno Setup Script Wizard 
 
1
; Script initially generated by the Inno Setup Script Wizard
2
2
; and then modified by Alexander Belchenko.
3
3
 
4
4
 
20
20
AppSupportURL=http://groups.google.com/group/qbzr
21
21
AppUpdatesURL=http://launchpad.net/qbzr/+download
22
22
 
23
 
DefaultDirName={userappdata}\bazaar\2.0\plugins\qbzr
 
23
;DefaultDirName={userappdata}\bazaar\2.0\plugins\qbzr
 
24
DefaultDirName={code:GetDirName}
 
25
 
24
26
DisableProgramGroupPage=yes
25
27
Compression=lzma
26
28
SolidCompression=yes
76
78
Source: "locale\*.*";  DestDir: {app}\locale; Flags: recursesubdirs; Components: main
77
79
Source: "installer\_lib\*.*"; DestDir: {app}\_lib; Flags: recursesubdirs; Components: libs
78
80
 
 
81
[UninstallDelete]
 
82
; TODO: create special uninstall function in Code section to recursively delete pyc/pyo files
 
83
;       using FindFile API
 
84
Type: files; Name: {app}\*.pyc
 
85
Type: files; Name: {app}\lib\*.pyc
 
86
Type: files; Name: {app}\lib\extra\*.pyc
 
87
Type: files; Name: {app}\lib\tests\*.pyc
 
88
Type: files; Name: {app}\*.pyo
 
89
Type: files; Name: {app}\lib\*.pyo
 
90
Type: files; Name: {app}\lib\extra\*.pyo
 
91
Type: files; Name: {app}\lib\tests\*.pyo
 
92
 
79
93
[Registry]
80
 
Root: HKLM; Subkey: "Software\QBzr\QBzr"; Flags: uninsdeletekey
81
 
Root: HKLM; Subkey: "Software\QBzr\QBzr"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
 
94
Root: HKLM; Subkey: "Software\QBzr"; Flags: uninsdeletekey
 
95
Root: HKLM; Subkey: "Software\QBzr"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"
 
96
 
 
97
[Code]
 
98
{Function detects system-wide installation of bzr: either bzr.exe or python-based}
 
99
function GetBzrPath(): String;
 
100
var
 
101
  BzrPath: String;
 
102
  PythonVersions: TArrayOfString;
 
103
  Ix: Integer;
 
104
  PythonKey: String;
 
105
  PythonPath: String;
 
106
  BzrlibPath: String;
 
107
  Path: String;
 
108
begin
 
109
  {Check bzr.exe presence}
 
110
  if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Bazaar', 'InstallPath', BzrPath) then begin
 
111
    Result := BzrPath;
 
112
  end else begin
 
113
    BzrlibPath := '';
 
114
    {Get list of all installed python versions}
 
115
    if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'Software\Python\PythonCore', PythonVersions) then begin
 
116
      {Iterate over installed pythons and check if there is installed bzrlib}
 
117
      for Ix := 0 to GetArrayLength(PythonVersions)-1 do begin
 
118
        PythonKey := 'Software\Python\PythonCore\' + PythonVersions[Ix] + '\InstallPath'
 
119
        if RegQueryStringValue(HKEY_LOCAL_MACHINE, PythonKey, '', PythonPath) then begin
 
120
          Path := AddBackslash(PythonPath) + 'Lib\site-packages\bzrlib'
 
121
          if DirExists(Path) then begin
 
122
            BzrlibPath := Path;
 
123
            break;
 
124
          end;
 
125
        end;
 
126
      end;
 
127
    end;
 
128
    Result := BzrlibPath;
 
129
  end;
 
130
end;
 
131
 
 
132
{Function determines best possible PATH to install QBzr.
 
133
  At first it tries to find system-wide installation (either bzr.exe or python-based)
 
134
  then checks BZR_PLUGIN_PATH,
 
135
  if all above fails then it suggests install to %APPDATA%\bazaar\2.0
 
136
}
 
137
function GetDirName(Param: String): String;
 
138
var
 
139
  Path: String;
 
140
  BzrPath: String;
 
141
  EnvBzrPluginPath: String;
 
142
  Ix: Integer;
 
143
begin
 
144
  Path := ExpandConstant('{userappdata}\bazaar\2.0\plugins\qbzr');
 
145
  BzrPath := GetBzrPath();
 
146
  if BzrPath <> '' then begin
 
147
     Path := AddBackslash(BzrPath) + 'plugins\qbzr';
 
148
  end else begin
 
149
      EnvBzrPluginPath := GetEnv('BZR_PLUGIN_PATH')
 
150
      Ix := Pos(';', EnvBzrPluginPath)
 
151
      if Ix > 0 then
 
152
        EnvBzrPluginPath := Copy(EnvBzrPluginPath, 1, Ix-1)
 
153
      if EnvBzrPluginPath <> '' then
 
154
        Path := AddBackslash(EnvBzrPluginPath) + 'qbzr';
 
155
  end;
 
156
  Result := Path;
 
157
end;