Skip to content

Commit fb72b2a

Browse files
committed
Including setup and activate overloads to skip Python version from params and use the current set up
Former-commit-id: 4efeaacfea6a09f3d0efdc32b1b5f91e350e3177 [formerly 1a5e15f96f08c599983a103fe34f3f18cafc2f2d] [formerly 3af53c9dc2d1a325c61649bfa5809324565e0735 [formerly 4758d1991f25221966123cab0a7983c96b0e8771]] Former-commit-id: 9f95287d9df982d0ca18ee8f9e92985662b9c7a1 [formerly 6a27cf7e93021977a3e3abc152944ba2f9e8104e] Former-commit-id: fe514a7748d84dcd23723312828a93c333ea1707 Former-commit-id: 500d9d2
1 parent eb6b5f9 commit fb72b2a

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/PyEnvironment.pas

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ TPyCustomEnvironment = class(TComponent, IEnvironmentNotifier<TPyCustomEnviron
9696
constructor Create(AOwner: TComponent); override;
9797
destructor Destroy(); override;
9898

99-
procedure Setup(APythonVersion: string);
100-
function SetupAsync(APythonVersion: string): ITask;
99+
procedure Setup(APythonVersion: string = '');
100+
function SetupAsync(APythonVersion: string = ''): ITask;
101101

102-
function Activate(APythonVersion: string): boolean;
102+
function Activate(APythonVersion: string = ''): boolean;
103103
procedure Deactivate();
104104
public
105105
property Distributions: TPyDistributionCollection read FDistributions write SetEnvironments;
@@ -131,8 +131,8 @@ TPyEnvironment = class(TPyCustomEnvironment)
131131
implementation
132132

133133
uses
134+
System.IOUtils, System.StrUtils,
134135
TypInfo,
135-
System.IOUtils,
136136
PyEnvironment.Path;
137137

138138
{ TPyCustomEnvironment }
@@ -173,19 +173,22 @@ procedure TPyCustomEnvironment.Notification(AComponent: TComponent;
173173

174174
procedure TPyCustomEnvironment.Setup(APythonVersion: string);
175175
begin
176-
InternalSetup(APythonVersion);
176+
InternalSetup(
177+
IfThen(APythonVersion.IsEmpty(), PythonVersion, APythonVersion));
177178
end;
178179

179180
function TPyCustomEnvironment.SetupAsync(APythonVersion: string): ITask;
180181
begin
181182
Result := TTask.Run(procedure() begin
182-
InternalSetup(APythonVersion);
183+
InternalSetup(
184+
IfThen(APythonVersion.IsEmpty(), PythonVersion, APythonVersion));
183185
end);
184186
end;
185187

186188
function TPyCustomEnvironment.Activate(APythonVersion: string): boolean;
187189
begin
188-
Result := InternalActivate(APythonVersion);
190+
Result := InternalActivate(
191+
IfThen(APythonVersion.IsEmpty(), PythonVersion, APythonVersion));
189192
end;
190193

191194
procedure TPyCustomEnvironment.Deactivate;

0 commit comments

Comments
 (0)