Skip to content

Commit 17a0a9d

Browse files
committed
Removed Py_GetPlatform
Added PythonExecutable to PythonVersions
1 parent 1a32148 commit 17a0a9d

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

PythonForDelphi/Components/Sources/Core/PythonEngine.pas

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,6 @@ TPythonInterface=class(TDynamicDll)
20692069
procedure Py_XINCREF ( op: PPyObject);
20702070
procedure Py_XDECREF ( op: PPyObject);
20712071

2072-
function Py_GetPlatform: PAnsiChar; cdecl;
20732072
function PyCode_Addr2Line( co: PPyCodeObject; addrq : Integer ) : Integer; cdecl;
20742073
function Py_GetBuildInfo: PAnsiChar; cdecl;
20752074
function PyImport_ExecCodeModule( const AName : AnsiString; codeobject : PPyObject) : PPyObject;
@@ -4125,11 +4124,6 @@ procedure TPythonInterface.Py_XDECREF(op: PPyObject);
41254124
if op <> nil then Py_DECREF(op);
41264125
end;
41274126

4128-
function TPythonInterface.Py_GetPlatform: PAnsiChar; cdecl;
4129-
begin
4130-
Py_GetPlatform := 'win32';
4131-
end;
4132-
41334127
// This function is copied from compile.c because it was not
41344128
// exported in the Dll
41354129
function TPythonInterface.PyCode_Addr2Line( co: PPyCodeObject; addrq : Integer ) : Integer; cdecl;

PythonForDelphi/Components/Sources/Core/PythonVersions.pas

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ TPythonVersion = record
2828
function GetDisplayName: string;
2929
function GetApiVersion: integer;
3030
function GetSysArchitecture: string;
31+
function GetPythonExecutable: string;
3132
public
3233
IsRegistered: Boolean;
3334
IsAllUsers: Boolean;
@@ -37,6 +38,7 @@ TPythonVersion = record
3738
InstallPath: string;
3839
PythonPath: string;
3940
procedure AssignTo(PythonEngine: TPersistent);
41+
property PythonExecutable: string read GetPythonExecutable;
4042
property DLLName: string read GetDLLName;
4143
property SysArchitecture: string read GetSysArchitecture;
4244
property IsPython3K: Boolean read GetIsPython3K;
@@ -156,6 +158,15 @@ function TPythonVersion.GetIsPython3K: Boolean;
156158
end;
157159
end;
158160

161+
function TPythonVersion.GetPythonExecutable: string;
162+
begin
163+
Result := IncludeTrailingPathDelimiter(InstallPath) + 'python.exe';
164+
if not FileExists(Result) then begin
165+
Result := IncludeTrailingPathDelimiter(InstallPath) + 'Scripts\python.exe';
166+
if not FileExists(Result) then Result := '';
167+
end;
168+
end;
169+
159170
function TPythonVersion.GetSysArchitecture: string;
160171
begin
161172
Result := fSysArchitecture;

0 commit comments

Comments
 (0)