Skip to content

Commit ad1bc99

Browse files
committed
fix again PythonVersionFromDLLName
1 parent 00d624b commit ad1bc99

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

python4lazarus/PythonEngine.pas

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8868,10 +8868,18 @@ procedure PythonVersionFromDLLName(LibName: string; out MajorVersion, MinorVersi
88688868
else //unknown char after major version
88698869
exit;
88708870
end;
8871-
NPos:= Pos('.', LibName); //dot with extension is required
8872-
if NPos=0 then exit;
8873-
Delete(LibName, NPos, MaxInt);
8874-
//support minor versions 0...MaxInt
8871+
//strip file extension and handle 'libpython3.10m.so'
8872+
for NPos:= 1 to Length(LibName) do
8873+
begin
8874+
case LibName[NPos] of
8875+
'.', 'a'..'z':
8876+
begin
8877+
SetLength(LibName, NPos-1);
8878+
Break
8879+
end;
8880+
end;
8881+
end;
8882+
//the rest is minor version number '0'...'999'
88758883
MinorVersion:= StrToIntDef(LibName, 0);
88768884
end;
88778885

0 commit comments

Comments
 (0)