Skip to content

Commit 6674717

Browse files
committed
1 parent 5f9cf2d commit 6674717

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Source/PythonEngine.pas

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9008,24 +9008,26 @@ function IsPythonVersionRegistered(PythonVersion : string;
90089008

90099009
procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersion: integer);
90109010
//Windows: 'c:\some\path\python310.dll'
9011-
//Linux: '/some/path/libpython3.10.so'
9011+
//Linux: '/some/path/libpython3.10m.so'
90129012
const
90139013
cPython = 'python';
9014+
DefaultMajor = 3;
9015+
DefaultMinor = 4;
90149016
var
90159017
NPos: integer;
90169018
ch: char;
90179019
begin
9018-
MajorVersion:= 0;
9019-
MinorVersion:= 0;
9020+
MajorVersion:= DefaultMajor;
9021+
MinorVersion:= DefaultMinor;
90209022
LibName:= LowerCase(ExtractFileName(LibName)); //strip path
90219023
NPos:= Pos(cPython, LibName);
90229024
if NPos=0 then exit;
90239025
Inc(NPos, Length(cPython));
90249026
if NPos>Length(LibName) then exit;
90259027
ch:= LibName[NPos];
90269028
case ch of
9027-
'2'..'5': //support major versions 2...5, default 3
9028-
MajorVersion:= StrToIntDef(ch, 3);
9029+
'2'..'5': //support major versions 2...5
9030+
MajorVersion:= StrToIntDef(ch, DefaultMajor);
90299031
else
90309032
exit;
90319033
end;
@@ -9051,7 +9053,7 @@ procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersi
90519053
end;
90529054
end;
90539055
//the rest is minor version number '0'...'999'
9054-
MinorVersion:= StrToIntDef(LibName, 0);
9056+
MinorVersion:= StrToIntDef(LibName, DefaultMinor);
90559057
end;
90569058

90579059

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy