@@ -38,6 +38,8 @@   TPythonVersion = record
3838    InstallPath: string;
3939    PythonPath: string;
4040    function  Is_venv : Boolean;
41+     function  Is_virtualenv : Boolean;
42+     function  Is_conda : Boolean;
4143    procedure  AssignTo (PythonEngine: TPersistent);
4244    property  PythonExecutable: string read GetPythonExecutable;
4345    property  DLLName: string read GetDLLName;
@@ -132,10 +134,23 @@ function TPythonVersion.GetApiVersion: integer;
132134end ;
133135
134136function  TPythonVersion.GetDisplayName : string;
137+ Var 
138+   FormatStr: string;
135139begin 
140+   if  FDisplayName = ' ' then 
141+   begin 
142+     if  Is_conda then 
143+       FormatStr := ' Conda %s (%s)' 
144+     else 
145+       FormatStr := ' Python %s (%s)' 
146+     if  Is_venv then 
147+       FormatStr := FormatStr + '  -venv' 
148+     else  if  Is_virtualenv then 
149+       FormatStr := FormatStr + '  -virtualenv' 
150+ 
151+     FDisplayName := Format(FormatStr, [SysVersion, SysArchitecture]);
152+   end ;
136153  Result := FDisplayName;
137-   if  Result = ' ' then 
138-     Result := Format(' Python %s (%s)' 
139154end ;
140155
141156function  TPythonVersion.GetHelpFile : string;
@@ -178,7 +193,12 @@ function TPythonVersion.GetSysArchitecture: string;
178193begin 
179194  Result := fSysArchitecture;
180195  if  Result = ' ' then 
181-     Result := ' Unknown' 
196+     Result := ' Unknown platform' 
197+ end ;
198+ 
199+ function  TPythonVersion.Is_conda : Boolean;
200+ begin 
201+   Result := FileExists(IncludeTrailingPathDelimiter(InstallPath) + ' scripts\conda.exe' 
182202end ;
183203
184204function  TPythonVersion.Is_venv : Boolean;
@@ -191,6 +211,12 @@ function TPythonVersion.Is_venv: Boolean;
191211    FileExists(IncludeTrailingPathDelimiter(InstallPath) + ' pyvenv.cfg' 
192212end ;
193213
214+ function  TPythonVersion.Is_virtualenv : Boolean;
215+ begin 
216+   Result := not  IsRegistered and  (InstallPath <> DLLPath) and 
217+     not  FileExists(IncludeTrailingPathDelimiter(InstallPath) + ' pyvenv.cfg' 
218+ end ;
219+ 
194220function   CompareVersions (A, B : String) : Integer;
195221
196222  function  GetNextNumber (var  Version: string): Integer;
0 commit comments