Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions Source/PythonVersions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -435,21 +435,18 @@ function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVer

function FindPythonDLL(APath : string): string;
Var
FindFileData: TWIN32FindData;
Handle : THandle;
DLLFileName: string;
I: integer;
begin
Result := '';
Handle := FindFirstFile(PWideChar(APath+'\python??.dll'), FindFileData);
if Handle = INVALID_HANDLE_VALUE then Exit; // not python dll
DLLFileName:= FindFileData.cFileName;
// skip if python3.dll was found
if Length(DLLFileName) <> 12 then FindNextFile(Handle, FindFileData);
if Handle = INVALID_HANDLE_VALUE then Exit;
Windows.FindClose(Handle);
DLLFileName:= FindFileData.cFileName;
if Length(DLLFileName) = 12 then
Result := DLLFileName;
APath := IncludeTrailingPathDelimiter(APath);
for I := High(PYTHON_KNOWN_VERSIONS) downto COMPILED_FOR_PYTHON_VERSION_INDEX do begin
DLLFileName := PYTHON_KNOWN_VERSIONS[I].DLLName;
if FileExists(APath+DLLFileName) then begin
Result := DLLFileName;
exit;
end;
end;
end;

function GetVenvBasePrefix(InstallPath: string): string;
Expand Down