@@ -2729,7 +2729,7 @@ procedure Register;
2729
2729
function PyType_HasFeature (AType : PPyTypeObject; AFlag : Integer) : Boolean;
2730
2730
function SysVersionFromDLLName (const DLLFileName : string): string;
2731
2731
procedure PythonVersionFromDLLName (LibName: string; out MajorVersion, MinorVersion: integer);
2732
- function SpliVersionFromRegVersion (const ARegVersion: string;
2732
+ function VersionFromRegVersion (const ARegVersion: string;
2733
2733
out AMajorVersion, AMinorVersion: integer): boolean;
2734
2734
2735
2735
{ Helper functions}
@@ -3246,7 +3246,7 @@ procedure TPythonInterface.AfterLoad;
3246
3246
inherited ;
3247
3247
if not FInExtensionModule then
3248
3248
PythonVersionFromDLLName(DLLName, FMajorVersion, FMinorVersion)
3249
- else if not SpliVersionFromRegVersion (RegVersion, FMajorVersion, FMinorVersion) then
3249
+ else if not VersionFromRegVersion (RegVersion, FMajorVersion, FMinorVersion) then
3250
3250
raise EDLLLoadError.Create(' Undetermined Python version.' );
3251
3251
3252
3252
FBuiltInModuleName := ' builtins' ;
@@ -4408,8 +4408,8 @@ procedure TPythonEngine.CheckRegistry;
4408
4408
Path : string;
4409
4409
NewPath : string;
4410
4410
{ $IFDEF CPUX86}
4411
- MajorVersion : integer;
4412
- MinorVersion : integer;
4411
+ LMajorVersion : integer;
4412
+ LMinorVersion : integer;
4413
4413
{ $ENDIF}
4414
4414
VersionSuffix: string;
4415
4415
{ $ENDIF}
@@ -4421,9 +4421,8 @@ procedure TPythonEngine.CheckRegistry;
4421
4421
try
4422
4422
VersionSuffix := ' ' ;
4423
4423
{ $IFDEF CPUX86}
4424
- MajorVersion := StrToInt(RegVersion[1 ]);
4425
- MinorVersion := StrToInt(Copy(RegVersion, 3 ));
4426
- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
4424
+ VersionFromRegVersion(RegVersion, LMajorVersion, LMinorVersion);
4425
+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
4427
4426
VersionSuffix := ' -32' ;
4428
4427
{ $ENDIF}
4429
4428
key := Format(' \Software\Python\PythonCore\%s%s\PythonPath' , [RegVersion, VersionSuffix]);
@@ -9153,17 +9152,16 @@ function IsPythonVersionRegistered(PythonVersion : string;
9153
9152
var
9154
9153
key: string;
9155
9154
VersionSuffix: string;
9156
- MajorVersion : integer;
9157
- MinorVersion : integer;
9155
+ LMajorVersion : integer;
9156
+ LMinorVersion : integer;
9158
9157
begin
9159
9158
Result := False;
9160
9159
InstallPath := ' ' ;
9161
9160
AllUserInstall := False;
9162
- MajorVersion := StrToInt(PythonVersion[1 ]);
9163
- MinorVersion := StrToInt(Copy(PythonVersion, 3 ));
9164
9161
VersionSuffix := ' ' ;
9162
+ VersionFromRegVersion(PythonVersion, LMajorVersion, LMinorVersion);
9165
9163
{ $IFDEF CPUX86}
9166
- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
9164
+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
9167
9165
VersionSuffix := ' -32' ;
9168
9166
{ $ENDIF}
9169
9167
key := Format(' \Software\Python\PythonCore\%s%s\InstallPath' , [PythonVersion, VersionSuffix]);
@@ -9191,7 +9189,7 @@ function IsPythonVersionRegistered(PythonVersion : string;
9191
9189
RootKey := HKEY_LOCAL_MACHINE;
9192
9190
if OpenKey(Key, False) then begin
9193
9191
AllUserInstall := True;
9194
- if (MajorVersion > 3 ) or ((MajorVersion = 3 ) and (MinorVersion >= 5 )) then
9192
+ if (LMajorVersion > 3 ) or ((LMajorVersion = 3 ) and (LMinorVersion >= 5 )) then
9195
9193
InstallPath := ReadString(' ' );
9196
9194
Result := True;
9197
9195
end ;
@@ -9253,7 +9251,7 @@ procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersi
9253
9251
MinorVersion:= StrToIntDef(LibName, DefaultMinor);
9254
9252
end ;
9255
9253
9256
- function SpliVersionFromRegVersion (const ARegVersion: string;
9254
+ function VersionFromRegVersion (const ARegVersion: string;
9257
9255
out AMajorVersion, AMinorVersion: integer): boolean;
9258
9256
var
9259
9257
LSepPos: integer;
0 commit comments