1function InitializeSetup(): Boolean;
2var
3    install_path : string;
4    rcb : Boolean;
5begin
6    rcb := RegQueryStringValue( HKLM,
7        'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d\InstallPath',
8        '', install_path );
9    if not rcb then
10    begin
11        rcb := RegQueryStringValue( HKLM,
12            'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d-32\InstallPath', '', install_path );
13        if not rcb then
14        begin
15            rcb := RegQueryStringValue( HKCU,
16                'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d\InstallPath', '', install_path );
17            if not rcb then
18            begin
19                rcb := RegQueryStringValue( HKCU,
20                    'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d-32\InstallPath', '', install_path );
21                if not rcb then
22                begin
23                    MsgBox( 'pysvn requires Win32 Python %(py_maj)d.%(py_min)d to be installed.' #13 #13
24                            'Quitting installation',
25                         mbError, MB_OK );
26                end;
27            end;
28        end;
29    end;
30    Result := rcb;
31end;
32
33function pythondir(Default: String): String;
34var
35    install_path : string;
36    rcb : Boolean;
37begin
38    rcb := RegQueryStringValue( HKLM,
39        'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d\InstallPath',
40        '', install_path );
41    if rcb then
42    begin
43        Result := install_path;
44    end
45    else
46    begin
47        rcb := RegQueryStringValue( HKLM,
48            'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d-32\InstallPath',
49            '', install_path );
50        if rcb then
51        begin
52            Result := install_path;
53        end
54        else
55        begin
56            rcb := RegQueryStringValue( HKCU,
57                'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d\InstallPath',
58                '', install_path );
59            if rcb then
60            begin
61                Result := install_path;
62            end
63            else
64            begin
65                rcb := RegQueryStringValue( HKCU,
66                    'SOFTWARE\Python\PythonCore\%(py_maj)d.%(py_min)d-32\InstallPath',
67                    '', install_path );
68                if rcb then
69                begin
70                    Result := install_path;
71                end
72                else
73                begin
74                    Result := 'c:\python%(py_maj)d.%(py_min)d';
75                end;
76            end;
77        end;
78    end;
79end;
80