3
3
import ai .lzy .env .EnvironmentInstallationException ;
4
4
import ai .lzy .env .base .BaseEnvironment ;
5
5
import ai .lzy .env .logs .LogStream ;
6
+ import jakarta .annotation .Nullable ;
6
7
import org .apache .commons .io .IOUtils ;
7
8
import org .apache .logging .log4j .LogManager ;
8
9
import org .apache .logging .log4j .Logger ;
9
10
10
11
import java .io .IOException ;
11
12
import java .nio .charset .StandardCharsets ;
12
13
import java .nio .file .Path ;
13
- import java .util .*;
14
+ import java .util .ArrayList ;
15
+ import java .util .Arrays ;
16
+ import java .util .List ;
17
+ import java .util .Map ;
14
18
15
19
public class PlainPythonEnvironment implements AuxEnvironment {
16
20
private static final Logger LOG = LogManager .getLogger (PlainPythonEnvironment .class );
17
21
18
22
private final BaseEnvironment baseEnv ;
19
23
private final Map <String , String > localModules ;
20
24
private final Path workingDir ;
25
+ private final String pythonBinary ;
21
26
22
- public PlainPythonEnvironment (BaseEnvironment baseEnv , Map <String , String > localModules , Path workingDir ) {
27
+ public PlainPythonEnvironment (BaseEnvironment baseEnv , Map <String , String > localModules , Path workingDir ,
28
+ @ Nullable String pythonBinary )
29
+ {
23
30
this .localModules = localModules ;
24
31
this .baseEnv = baseEnv ;
25
32
this .workingDir = workingDir ;
33
+ this .pythonBinary = pythonBinary != null ? pythonBinary : "python" ;
26
34
}
27
35
28
36
@ Override
@@ -32,7 +40,7 @@ public BaseEnvironment base() {
32
40
33
41
@ Override
34
42
public void install (LogStream outStream , LogStream errStream ) throws EnvironmentInstallationException {
35
- var proc = baseEnv .runProcess ("python" , "--version" );
43
+ var proc = baseEnv .runProcess (pythonBinary , "--version" );
36
44
final int res ;
37
45
38
46
try {
0 commit comments