Skip to content

Commit 72a531c

Browse files
committed
add java property to use external launcher with vfs
1 parent aca28ad commit 72a531c

File tree

1 file changed

+9
-4
lines changed
  • graalpython/org.graalvm.python.embedding.tools/src/org/graalvm/python/embedding/tools/vfs

1 file changed

+9
-4
lines changed

graalpython/org.graalvm.python.embedding.tools/src/org/graalvm/python/embedding/tools/vfs/VFSUtils.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import java.io.IOException;
4949
import java.nio.file.FileVisitResult;
5050
import java.nio.file.Files;
51-
import java.nio.file.LinkOption;
5251
import java.nio.file.Path;
5352
import java.nio.file.Paths;
5453
import java.nio.file.SimpleFileVisitor;
@@ -392,9 +391,15 @@ public void log(CharSequence var1) {
392391
}
393392
}
394393

395-
public static void createVenv(Path venvDirectory, List<String> packages, Path laucherPath, LauncherClassPath launcherClassPath, String graalPyVersion, SubprocessLog subprocessLog, Log log)
394+
public static void createVenv(Path venvDirectory, List<String> packages, Path launcher, LauncherClassPath launcherClassPath, String graalPyVersion, SubprocessLog subprocessLog, Log log)
396395
throws IOException {
397-
generateLaunchers(laucherPath, launcherClassPath, subprocessLog, log);
396+
Path launcherPath = launcher;
397+
String externalLauncher = System.getProperty("graalpy.vfs.venvLauncher");
398+
if (externalLauncher == null || externalLauncher.trim().isEmpty()) {
399+
generateLaunchers(launcherPath, launcherClassPath, subprocessLog, log);
400+
} else {
401+
launcherPath = Path.of(externalLauncher);
402+
}
398403

399404
if (packages != null) {
400405
trim(packages);
@@ -424,7 +429,7 @@ public static void createVenv(Path venvDirectory, List<String> packages, Path la
424429

425430
if (!Files.exists(venvDirectory)) {
426431
log.info(String.format("Creating GraalPy %s venv", graalPyVersion));
427-
runLauncher(laucherPath.toString(), subprocessLog, "-m", "venv", venvDirectory.toString(), "--without-pip");
432+
runLauncher(launcherPath.toString(), subprocessLog, "-m", "venv", venvDirectory.toString(), "--without-pip");
428433
runVenvBin(venvDirectory, "graalpy", subprocessLog, "-I", "-m", "ensurepip");
429434
}
430435

0 commit comments

Comments
 (0)